QskLinearLayoutEngine setter indicating changes
This commit is contained in:
parent
16a67678f3
commit
4f48a3ab92
|
@ -290,15 +290,8 @@ bool QskLinearBox::event( QEvent* event )
|
||||||
|
|
||||||
void QskLinearBox::setDimension( uint dimension )
|
void QskLinearBox::setDimension( uint dimension )
|
||||||
{
|
{
|
||||||
if ( dimension < 1 )
|
if ( m_data->engine.setDimension( dimension ) )
|
||||||
dimension = 1;
|
|
||||||
|
|
||||||
auto& engine = m_data->engine;
|
|
||||||
|
|
||||||
if ( dimension != engine.dimension() )
|
|
||||||
{
|
{
|
||||||
engine.setDimension( dimension );
|
|
||||||
|
|
||||||
polish();
|
polish();
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
|
|
||||||
|
@ -313,12 +306,8 @@ uint QskLinearBox::dimension() const
|
||||||
|
|
||||||
void QskLinearBox::setOrientation( Qt::Orientation orientation )
|
void QskLinearBox::setOrientation( Qt::Orientation orientation )
|
||||||
{
|
{
|
||||||
auto& engine = m_data->engine;
|
if ( m_data->engine.setOrientation( orientation ) )
|
||||||
|
|
||||||
if ( engine.orientation() != orientation )
|
|
||||||
{
|
{
|
||||||
engine.setOrientation( orientation );
|
|
||||||
|
|
||||||
polish();
|
polish();
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
|
|
||||||
|
@ -356,13 +345,8 @@ void QskLinearBox::transpose()
|
||||||
|
|
||||||
void QskLinearBox::setDefaultAlignment( Qt::Alignment alignment )
|
void QskLinearBox::setDefaultAlignment( Qt::Alignment alignment )
|
||||||
{
|
{
|
||||||
auto& engine = m_data->engine;
|
if ( m_data->engine.setDefaultAlignment( alignment ) )
|
||||||
|
|
||||||
if ( alignment != engine.defaultAlignment() )
|
|
||||||
{
|
|
||||||
engine.setDefaultAlignment( alignment );
|
|
||||||
Q_EMIT defaultAlignmentChanged();
|
Q_EMIT defaultAlignmentChanged();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Alignment QskLinearBox::defaultAlignment() const
|
Qt::Alignment QskLinearBox::defaultAlignment() const
|
||||||
|
@ -377,15 +361,11 @@ void QskLinearBox::setSpacing( qreal spacing )
|
||||||
but need to create an API for Qml in QskQml
|
but need to create an API for Qml in QskQml
|
||||||
using qmlAttachedPropertiesObject then. TODO ...
|
using qmlAttachedPropertiesObject then. TODO ...
|
||||||
*/
|
*/
|
||||||
spacing = qMax( spacing, 0.0 );
|
|
||||||
|
|
||||||
auto& engine = m_data->engine;
|
if ( m_data->engine.setSpacing(
|
||||||
|
spacing, Qt::Horizontal | Qt::Vertical ) )
|
||||||
if ( spacing != engine.spacing( Qt::Horizontal ) )
|
|
||||||
{
|
{
|
||||||
engine.setSpacing( spacing, Qt::Horizontal | Qt::Vertical );
|
|
||||||
polish();
|
polish();
|
||||||
|
|
||||||
Q_EMIT spacingChanged();
|
Q_EMIT spacingChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -620,10 +620,13 @@ QskLinearLayoutEngine::~QskLinearLayoutEngine()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setOrientation( Qt::Orientation orientation )
|
bool QskLinearLayoutEngine::setOrientation( Qt::Orientation orientation )
|
||||||
{
|
{
|
||||||
if ( m_data->entryTable.setOrientation( orientation ) )
|
const bool isModified = m_data->entryTable.setOrientation( orientation );
|
||||||
|
if ( isModified )
|
||||||
invalidate( CellCache | LayoutCache );
|
invalidate( CellCache | LayoutCache );
|
||||||
|
|
||||||
|
return isModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Orientation QskLinearLayoutEngine::orientation() const
|
Qt::Orientation QskLinearLayoutEngine::orientation() const
|
||||||
|
@ -631,13 +634,18 @@ Qt::Orientation QskLinearLayoutEngine::orientation() const
|
||||||
return m_data->entryTable.orientation();
|
return m_data->entryTable.orientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setDimension( uint dimension )
|
bool QskLinearLayoutEngine::setDimension( uint dimension )
|
||||||
{
|
{
|
||||||
if ( dimension < 1 )
|
if ( dimension < 1 )
|
||||||
dimension = 1;
|
dimension = 1;
|
||||||
|
|
||||||
if ( m_data->entryTable.setDimension( dimension ) )
|
const bool isModified =
|
||||||
|
m_data->entryTable.setDimension( dimension );
|
||||||
|
|
||||||
|
if ( isModified )
|
||||||
invalidate( CellCache | LayoutCache );
|
invalidate( CellCache | LayoutCache );
|
||||||
|
|
||||||
|
return isModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint QskLinearLayoutEngine::dimension() const
|
uint QskLinearLayoutEngine::dimension() const
|
||||||
|
@ -660,10 +668,15 @@ int QskLinearLayoutEngine::columnCount() const
|
||||||
return m_data->entryTable.effectiveCount( Qt::Horizontal );
|
return m_data->entryTable.effectiveCount( Qt::Horizontal );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setRetainSizeWhenHiddenAt( int index, bool on )
|
bool QskLinearLayoutEngine::setRetainSizeWhenHiddenAt( int index, bool on )
|
||||||
{
|
{
|
||||||
if ( m_data->entryTable.setRetainSizeWhenHiddenAt( index, on ) )
|
const bool isModified =
|
||||||
|
m_data->entryTable.setRetainSizeWhenHiddenAt( index, on );
|
||||||
|
|
||||||
|
if ( isModified )
|
||||||
invalidate( CellCache | LayoutCache );
|
invalidate( CellCache | LayoutCache );
|
||||||
|
|
||||||
|
return isModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskLinearLayoutEngine::retainSizeWhenHiddenAt( int index ) const
|
bool QskLinearLayoutEngine::retainSizeWhenHiddenAt( int index ) const
|
||||||
|
@ -671,10 +684,15 @@ bool QskLinearLayoutEngine::retainSizeWhenHiddenAt( int index ) const
|
||||||
return m_data->entryTable.retainSizeWhenHiddenAt( index );
|
return m_data->entryTable.retainSizeWhenHiddenAt( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setStretchFactorAt( int index, int stretchFactor )
|
bool QskLinearLayoutEngine::setStretchFactorAt( int index, int stretchFactor )
|
||||||
{
|
{
|
||||||
if ( m_data->entryTable.setStretchFactorAt( index, stretchFactor ) )
|
const bool isModified =
|
||||||
|
m_data->entryTable.setStretchFactorAt( index, stretchFactor );
|
||||||
|
|
||||||
|
if ( isModified )
|
||||||
invalidate( CellCache | LayoutCache );
|
invalidate( CellCache | LayoutCache );
|
||||||
|
|
||||||
|
return isModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskLinearLayoutEngine::stretchFactorAt( int index ) const
|
int QskLinearLayoutEngine::stretchFactorAt( int index ) const
|
||||||
|
@ -682,9 +700,9 @@ int QskLinearLayoutEngine::stretchFactorAt( int index ) const
|
||||||
return m_data->entryTable.stretchFactorAt( index );
|
return m_data->entryTable.stretchFactorAt( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setAlignmentAt( int index, Qt::Alignment alignment )
|
bool QskLinearLayoutEngine::setAlignmentAt( int index, Qt::Alignment alignment )
|
||||||
{
|
{
|
||||||
m_data->entryTable.setAlignmentAt( index, alignment );
|
return m_data->entryTable.setAlignmentAt( index, alignment );
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Alignment QskLinearLayoutEngine::alignmentAt( int index ) const
|
Qt::Alignment QskLinearLayoutEngine::alignmentAt( int index ) const
|
||||||
|
@ -692,21 +710,23 @@ Qt::Alignment QskLinearLayoutEngine::alignmentAt( int index ) const
|
||||||
return m_data->entryTable.alignmentAt( index );
|
return m_data->entryTable.alignmentAt( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setSpacing( qreal spacing, Qt::Orientations orientations )
|
bool QskLinearLayoutEngine::setSpacing( qreal spacing, Qt::Orientations orientations )
|
||||||
{
|
{
|
||||||
if ( spacing < 0.0 )
|
if ( spacing < 0.0 )
|
||||||
spacing = 0.0;
|
spacing = 0.0;
|
||||||
|
|
||||||
bool doInvalidate = false;
|
bool isModified = false;
|
||||||
|
|
||||||
if ( orientations & Qt::Horizontal )
|
if ( orientations & Qt::Horizontal )
|
||||||
doInvalidate |= m_data->colChain.setSpacing( spacing );
|
isModified |= m_data->colChain.setSpacing( spacing );
|
||||||
|
|
||||||
if ( orientations & Qt::Vertical )
|
if ( orientations & Qt::Vertical )
|
||||||
doInvalidate |= m_data->rowChain.setSpacing( spacing );
|
isModified |= m_data->rowChain.setSpacing( spacing );
|
||||||
|
|
||||||
if ( doInvalidate )
|
if ( isModified )
|
||||||
invalidate( CellCache | LayoutCache );
|
invalidate( CellCache | LayoutCache );
|
||||||
|
|
||||||
|
return isModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskLinearLayoutEngine::spacing( Qt::Orientation orientation ) const
|
qreal QskLinearLayoutEngine::spacing( Qt::Orientation orientation ) const
|
||||||
|
@ -717,10 +737,10 @@ qreal QskLinearLayoutEngine::spacing( Qt::Orientation orientation ) const
|
||||||
return m_data->rowChain.spacing();
|
return m_data->rowChain.spacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setExtraSpacingAt( Qt::Edges edges )
|
bool QskLinearLayoutEngine::setExtraSpacingAt( Qt::Edges edges )
|
||||||
{
|
{
|
||||||
if ( edges == m_data->extraSpacingAt )
|
if ( edges == m_data->extraSpacingAt )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
m_data->extraSpacingAt = edges;
|
m_data->extraSpacingAt = edges;
|
||||||
|
|
||||||
|
@ -743,6 +763,7 @@ void QskLinearLayoutEngine::setExtraSpacingAt( Qt::Edges edges )
|
||||||
m_data->rowChain.setExtraSpacingAt( rowEdges );
|
m_data->rowChain.setExtraSpacingAt( rowEdges );
|
||||||
|
|
||||||
invalidate( LayoutCache );
|
invalidate( LayoutCache );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Edges QskLinearLayoutEngine::extraSpacingAt() const
|
Qt::Edges QskLinearLayoutEngine::extraSpacingAt() const
|
||||||
|
@ -750,9 +771,9 @@ Qt::Edges QskLinearLayoutEngine::extraSpacingAt() const
|
||||||
return m_data->extraSpacingAt;
|
return m_data->extraSpacingAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setDefaultAlignment( Qt::Alignment alignment )
|
bool QskLinearLayoutEngine::setDefaultAlignment( Qt::Alignment alignment )
|
||||||
{
|
{
|
||||||
m_data->entryTable.setDefaultAlignment( alignment );
|
return m_data->entryTable.setDefaultAlignment( alignment );
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Alignment QskLinearLayoutEngine::defaultAlignment() const
|
Qt::Alignment QskLinearLayoutEngine::defaultAlignment() const
|
||||||
|
@ -935,9 +956,15 @@ qreal QskLinearLayoutEngine::heightForWidth( qreal width ) const
|
||||||
return sizeHint( Qt::PreferredSize, constraint ).height();
|
return sizeHint( Qt::PreferredSize, constraint ).height();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskLinearLayoutEngine::setVisualDirection(Qt::LayoutDirection direction)
|
bool QskLinearLayoutEngine::setVisualDirection(Qt::LayoutDirection direction)
|
||||||
{
|
{
|
||||||
|
if ( m_data->visualDirection != direction )
|
||||||
|
{
|
||||||
m_data->visualDirection = direction;
|
m_data->visualDirection = direction;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::LayoutDirection QskLinearLayoutEngine::visualDirection() const
|
Qt::LayoutDirection QskLinearLayoutEngine::visualDirection() const
|
||||||
|
|
|
@ -19,26 +19,30 @@ class QskLinearLayoutEngine
|
||||||
~QskLinearLayoutEngine();
|
~QskLinearLayoutEngine();
|
||||||
|
|
||||||
Qt::Orientation orientation() const;
|
Qt::Orientation orientation() const;
|
||||||
void setOrientation( Qt::Orientation );
|
bool setOrientation( Qt::Orientation );
|
||||||
|
|
||||||
void setDimension( uint dimension );
|
bool setDimension( uint dimension );
|
||||||
uint dimension() const;
|
uint dimension() const;
|
||||||
|
|
||||||
void setDefaultAlignment( Qt::Alignment );
|
bool setDefaultAlignment( Qt::Alignment );
|
||||||
Qt::Alignment defaultAlignment() const;
|
Qt::Alignment defaultAlignment() const;
|
||||||
|
|
||||||
void setExtraSpacingAt( Qt::Edges );
|
bool setExtraSpacingAt( Qt::Edges );
|
||||||
Qt::Edges extraSpacingAt() const;
|
Qt::Edges extraSpacingAt() const;
|
||||||
|
|
||||||
|
bool setVisualDirection( Qt::LayoutDirection );
|
||||||
|
Qt::LayoutDirection visualDirection() const;
|
||||||
|
|
||||||
|
bool setSpacing( qreal spacing, Qt::Orientations );
|
||||||
|
qreal spacing( Qt::Orientation ) const;
|
||||||
|
|
||||||
|
qreal defaultSpacing( Qt::Orientation ) const;
|
||||||
|
|
||||||
int count() const;
|
int count() const;
|
||||||
|
|
||||||
int rowCount() const;
|
int rowCount() const;
|
||||||
int columnCount() const;
|
int columnCount() const;
|
||||||
|
|
||||||
void setSpacing( qreal spacing, Qt::Orientations );
|
|
||||||
qreal spacing( Qt::Orientation ) const;
|
|
||||||
qreal defaultSpacing( Qt::Orientation ) const;
|
|
||||||
|
|
||||||
void insertItem( QQuickItem*, int index );
|
void insertItem( QQuickItem*, int index );
|
||||||
void addItem( QQuickItem* );
|
void addItem( QQuickItem* );
|
||||||
|
|
||||||
|
@ -50,13 +54,13 @@ class QskLinearLayoutEngine
|
||||||
QQuickItem* itemAt( int index ) const;
|
QQuickItem* itemAt( int index ) const;
|
||||||
int spacerAt( int index ) const;
|
int spacerAt( int index ) const;
|
||||||
|
|
||||||
void setRetainSizeWhenHiddenAt( int index, bool on );
|
bool setRetainSizeWhenHiddenAt( int index, bool on );
|
||||||
bool retainSizeWhenHiddenAt( int index ) const;
|
bool retainSizeWhenHiddenAt( int index ) const;
|
||||||
|
|
||||||
void setAlignmentAt( int index, Qt::Alignment );
|
bool setAlignmentAt( int index, Qt::Alignment );
|
||||||
Qt::Alignment alignmentAt( int index ) const;
|
Qt::Alignment alignmentAt( int index ) const;
|
||||||
|
|
||||||
void setStretchFactorAt( int index, int stretchFactor );
|
bool setStretchFactorAt( int index, int stretchFactor );
|
||||||
int stretchFactorAt( int index ) const;
|
int stretchFactorAt( int index ) const;
|
||||||
|
|
||||||
void setGeometries( const QRectF& );
|
void setGeometries( const QRectF& );
|
||||||
|
@ -66,9 +70,6 @@ class QskLinearLayoutEngine
|
||||||
|
|
||||||
QSizeF sizeHint( Qt::SizeHint, const QSizeF& contraint ) const;
|
QSizeF sizeHint( Qt::SizeHint, const QSizeF& contraint ) const;
|
||||||
|
|
||||||
void setVisualDirection( Qt::LayoutDirection );
|
|
||||||
Qt::LayoutDirection visualDirection() const;
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
EntryCache = 1 << 0,
|
EntryCache = 1 << 0,
|
||||||
|
|
Loading…
Reference in New Issue