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