QskLinearBox::count, src/layouts/QskGridBox::count
This commit is contained in:
parent
fae80c3107
commit
401adac3ba
|
@ -105,7 +105,7 @@ Box::Box( QQuickItem* parent )
|
||||||
|
|
||||||
void Box::flip()
|
void Box::flip()
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < entryCount(); i++ )
|
for ( int i = 0; i < count(); i++ )
|
||||||
{
|
{
|
||||||
if ( auto control = dynamic_cast< Control* >( itemAtIndex( i ) ) )
|
if ( auto control = dynamic_cast< Control* >( itemAtIndex( i ) ) )
|
||||||
control->transpose();
|
control->transpose();
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace
|
||||||
void addRectangle( const char* colorName )
|
void addRectangle( const char* colorName )
|
||||||
{
|
{
|
||||||
auto rect = new TestRectangle( colorName );
|
auto rect = new TestRectangle( colorName );
|
||||||
rect->setText( QString::number( entryCount() + 1 ) );
|
rect->setText( QString::number( count() + 1 ) );
|
||||||
|
|
||||||
addItem( rect, Qt::AlignCenter );
|
addItem( rect, Qt::AlignCenter );
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace
|
||||||
void addRectangle( const char* colorName )
|
void addRectangle( const char* colorName )
|
||||||
{
|
{
|
||||||
auto rect = new TestRectangle( colorName );
|
auto rect = new TestRectangle( colorName );
|
||||||
rect->setText( QString::number( entryCount() + 1 ) );
|
rect->setText( QString::number( count() + 1 ) );
|
||||||
|
|
||||||
addItem( rect, Qt::AlignCenter );
|
addItem( rect, Qt::AlignCenter );
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ class SliderBox : public QskLinearBox
|
||||||
customSlider->setStepSize( 10 );
|
customSlider->setStepSize( 10 );
|
||||||
customSlider->setPageSize( 10 );
|
customSlider->setPageSize( 10 );
|
||||||
|
|
||||||
for ( int i = 0; i < entryCount(); i++ )
|
for ( int i = 0; i < count(); i++ )
|
||||||
{
|
{
|
||||||
if ( auto slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) )
|
if ( auto slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) )
|
||||||
{
|
{
|
||||||
|
@ -151,7 +151,7 @@ class SliderBox : public QskLinearBox
|
||||||
{
|
{
|
||||||
setOrientation( inverted( orientation() ) );
|
setOrientation( inverted( orientation() ) );
|
||||||
|
|
||||||
for ( int i = 0; i < entryCount(); i++ )
|
for ( int i = 0; i < count(); i++ )
|
||||||
{
|
{
|
||||||
if ( auto slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) )
|
if ( auto slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) )
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ class SliderBox : public QskLinearBox
|
||||||
|
|
||||||
slider->setOrientation( orientation );
|
slider->setOrientation( orientation );
|
||||||
|
|
||||||
if ( i >= entryCount() - 1 )
|
if ( i >= count() - 1 )
|
||||||
{
|
{
|
||||||
// we didn't implement the vertical mode of the heavily
|
// we didn't implement the vertical mode of the heavily
|
||||||
// customized slider yet.
|
// customized slider yet.
|
||||||
|
|
|
@ -87,7 +87,7 @@ void Window::centerButtons()
|
||||||
QVector< QskDialogButtonBox* > Window::dialogBoxes() const
|
QVector< QskDialogButtonBox* > Window::dialogBoxes() const
|
||||||
{
|
{
|
||||||
QVector< QskDialogButtonBox* > boxes;
|
QVector< QskDialogButtonBox* > boxes;
|
||||||
for ( int i = 0; i < m_layoutBox->entryCount(); i++ )
|
for ( int i = 0; i < m_layoutBox->count(); i++ )
|
||||||
{
|
{
|
||||||
if ( auto box = qobject_cast< QskDialogButtonBox* >( m_layoutBox->itemAtIndex( i ) ) )
|
if ( auto box = qobject_cast< QskDialogButtonBox* >( m_layoutBox->itemAtIndex( i ) ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace
|
||||||
QskControl::keyPressEvent.
|
QskControl::keyPressEvent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for ( int i = 0; i < entryCount(); i++ )
|
for ( int i = 0; i < count(); i++ )
|
||||||
{
|
{
|
||||||
if ( auto button = itemAtIndex( i ) )
|
if ( auto button = itemAtIndex( i ) )
|
||||||
button->setZ( i == currentIndex ? 0.001 : 0.0 );
|
button->setZ( i == currentIndex ? 0.001 : 0.0 );
|
||||||
|
@ -179,8 +179,8 @@ int QskTabBar::insertTab( int index, QskTabButton* button )
|
||||||
{
|
{
|
||||||
auto buttonBox = m_data->buttonBox;
|
auto buttonBox = m_data->buttonBox;
|
||||||
|
|
||||||
if ( index < 0 || index >= buttonBox->entryCount() )
|
if ( index < 0 || index >= buttonBox->count() )
|
||||||
index = buttonBox->entryCount();
|
index = buttonBox->count();
|
||||||
|
|
||||||
if ( isComponentComplete() )
|
if ( isComponentComplete() )
|
||||||
{
|
{
|
||||||
|
@ -323,7 +323,7 @@ int QskTabBar::currentIndex() const
|
||||||
|
|
||||||
int QskTabBar::count() const
|
int QskTabBar::count() const
|
||||||
{
|
{
|
||||||
return m_data->buttonBox->entryCount();
|
return m_data->buttonBox->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTabButton* QskTabBar::buttonAt( int position )
|
QskTabButton* QskTabBar::buttonAt( int position )
|
||||||
|
|
|
@ -106,7 +106,7 @@ void QskGridBox::removeItem( const QQuickItem* item )
|
||||||
|
|
||||||
void QskGridBox::clear( bool autoDelete )
|
void QskGridBox::clear( bool autoDelete )
|
||||||
{
|
{
|
||||||
for ( int i = itemCount() - 1; i >= 0; i-- )
|
for ( int i = count() - 1; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
auto item = itemAtIndex( i );
|
auto item = itemAtIndex( i );
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ void QskGridBox::clear( bool autoDelete )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskGridBox::itemCount() const
|
int QskGridBox::count() const
|
||||||
{
|
{
|
||||||
return m_data->engine.itemCount();
|
return m_data->engine.itemCount();
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ void QskGridBox::updateLayout()
|
||||||
|
|
||||||
QSizeF QskGridBox::contentsSizeHint() const
|
QSizeF QskGridBox::contentsSizeHint() const
|
||||||
{
|
{
|
||||||
if ( itemCount() == 0 )
|
if ( count() == 0 )
|
||||||
return QSizeF( 0, 0 );
|
return QSizeF( 0, 0 );
|
||||||
|
|
||||||
return m_data->engine.sizeHint( Qt::PreferredSize, QSizeF() );
|
return m_data->engine.sizeHint( Qt::PreferredSize, QSizeF() );
|
||||||
|
|
|
@ -13,7 +13,7 @@ class QSK_EXPORT QskGridBox : public QskBox
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY( bool empty READ isEmpty() )
|
Q_PROPERTY( bool empty READ isEmpty() )
|
||||||
Q_PROPERTY( int itemCount READ itemCount() )
|
Q_PROPERTY( int count READ count )
|
||||||
|
|
||||||
using Inherited = QskBox;
|
using Inherited = QskBox;
|
||||||
|
|
||||||
|
@ -35,7 +35,11 @@ class QSK_EXPORT QskGridBox : public QskBox
|
||||||
Q_INVOKABLE int rowCount() const;
|
Q_INVOKABLE int rowCount() const;
|
||||||
Q_INVOKABLE int columnCount() const;
|
Q_INVOKABLE int columnCount() const;
|
||||||
|
|
||||||
int itemCount() const;
|
int count() const;
|
||||||
|
|
||||||
|
#ifdef QSK_LAYOUT_COMPAT
|
||||||
|
int itemCount() const { return count(); } // items and spacers
|
||||||
|
#endif
|
||||||
QQuickItem* itemAtIndex( int index ) const;
|
QQuickItem* itemAtIndex( int index ) const;
|
||||||
int indexOf( const QQuickItem* ) const;
|
int indexOf( const QQuickItem* ) const;
|
||||||
|
|
||||||
|
@ -56,7 +60,10 @@ class QSK_EXPORT QskGridBox : public QskBox
|
||||||
void resetSpacing( Qt::Orientations );
|
void resetSpacing( Qt::Orientations );
|
||||||
qreal spacing( Qt::Orientation ) const;
|
qreal spacing( Qt::Orientation ) const;
|
||||||
|
|
||||||
|
void setSpacing( qreal spacing );
|
||||||
|
|
||||||
#ifdef QSK_LAYOUT_COMPAT
|
#ifdef QSK_LAYOUT_COMPAT
|
||||||
|
|
||||||
void setVerticalSpacing( qreal spacing ) { setSpacing( Qt::Vertical, spacing ); }
|
void setVerticalSpacing( qreal spacing ) { setSpacing( Qt::Vertical, spacing ); }
|
||||||
qreal verticalSpacing() const { return spacing( Qt::Vertical ); }
|
qreal verticalSpacing() const { return spacing( Qt::Vertical ); }
|
||||||
|
|
||||||
|
@ -142,7 +149,12 @@ inline void QskGridBox::addItem(
|
||||||
|
|
||||||
inline bool QskGridBox::isEmpty() const
|
inline bool QskGridBox::isEmpty() const
|
||||||
{
|
{
|
||||||
return itemCount() <= 0;
|
return count() <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskGridBox::setSpacing( qreal spacing )
|
||||||
|
{
|
||||||
|
setSpacing( Qt::Horizontal | Qt::Vertical, spacing );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -76,7 +76,7 @@ void QskLayoutHint::normalize()
|
||||||
|
|
||||||
bool QskLayoutHint::isDefault() const
|
bool QskLayoutHint::isDefault() const
|
||||||
{
|
{
|
||||||
return ( m_minimum == 0.0 ) && (m_preferred == 0.0 )
|
return ( m_minimum == 0.0 ) && ( m_preferred == 0.0 )
|
||||||
&& ( m_maximum == QskLayoutConstraint::unlimited );
|
&& ( m_maximum == QskLayoutConstraint::unlimited );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ QskLinearBox::~QskLinearBox()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskLinearBox::entryCount() const
|
int QskLinearBox::count() const
|
||||||
{
|
{
|
||||||
return m_data->engine.count();
|
return m_data->engine.count();
|
||||||
}
|
}
|
||||||
|
@ -155,8 +155,8 @@ void QskLinearBox::clear( bool autoDelete )
|
||||||
{
|
{
|
||||||
auto& engine = m_data->engine;
|
auto& engine = m_data->engine;
|
||||||
|
|
||||||
// do we have visible entries
|
// do we have visible elements
|
||||||
const bool hasVisibleEntries = engine.rowCount() > 0;
|
const bool hasVisibleElements = engine.rowCount() > 0;
|
||||||
|
|
||||||
for ( int i = engine.count() - 1; i >= 0; i-- )
|
for ( int i = engine.count() - 1; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
|
@ -174,7 +174,7 @@ void QskLinearBox::clear( bool autoDelete )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasVisibleEntries )
|
if ( hasVisibleElements )
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class QSK_EXPORT QskLinearBox : public QskIndexedLayoutBox
|
||||||
Q_PROPERTY( Qt::Edges extraSpacingAt READ extraSpacingAt
|
Q_PROPERTY( Qt::Edges extraSpacingAt READ extraSpacingAt
|
||||||
WRITE setExtraSpacingAt NOTIFY extraSpacingAtChanged )
|
WRITE setExtraSpacingAt NOTIFY extraSpacingAtChanged )
|
||||||
|
|
||||||
Q_PROPERTY( int entryCount READ entryCount() )
|
Q_PROPERTY( int count READ count )
|
||||||
Q_PROPERTY( bool empty READ isEmpty() )
|
Q_PROPERTY( bool empty READ isEmpty() )
|
||||||
|
|
||||||
using Inherited = QskIndexedLayoutBox;
|
using Inherited = QskIndexedLayoutBox;
|
||||||
|
@ -40,10 +40,10 @@ class QSK_EXPORT QskLinearBox : public QskIndexedLayoutBox
|
||||||
~QskLinearBox() override;
|
~QskLinearBox() override;
|
||||||
|
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
int entryCount() const; // items and spacers
|
int count() const; // items and spacers
|
||||||
|
|
||||||
#ifdef QSK_LAYOUT_COMPAT
|
#ifdef QSK_LAYOUT_COMPAT
|
||||||
int itemCount() const { return entryCount(); } // items and spacers
|
int itemCount() const { return count(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int spacingAtIndex( int index ) const;
|
int spacingAtIndex( int index ) const;
|
||||||
|
@ -137,7 +137,7 @@ class QSK_EXPORT QskLinearBox : public QskIndexedLayoutBox
|
||||||
|
|
||||||
inline bool QskLinearBox::isEmpty() const
|
inline bool QskLinearBox::isEmpty() const
|
||||||
{
|
{
|
||||||
return entryCount() <= 0;
|
return count() <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue