diff --git a/src/layouts/QskGridBox.cpp b/src/layouts/QskGridBox.cpp index 225989f5..a457068a 100644 --- a/src/layouts/QskGridBox.cpp +++ b/src/layouts/QskGridBox.cpp @@ -7,6 +7,7 @@ #include "QskGridLayoutEngine.h" #include "QskEvent.h" #include "QskQuick.h" +#include #include static void qskSetItemActive( QObject* receiver, const QQuickItem* item, bool on ) @@ -470,4 +471,53 @@ bool QskGridBox::event( QEvent* event ) return Inherited::event( event ); } +void QskGridBox::dump() +{ + const auto& engine = m_data->engine; + + auto debug = qDebug(); + + QDebugStateSaver saver( debug ); + debug.nospace(); + + const auto constraint = sizeConstraint(); + + debug << "QskGridBox" + << "[" << engine.columnCount() << "," << engine.rowCount() << "] w:" + << constraint.width() << " h:" << constraint.height() << '\n'; + + for ( int i = 0; i < engine.count(); i++ ) + { + const auto grid = engine.gridAt( i ); + + debug << " ["; + + debug << grid.left(); + if ( grid.width() > 1 ) + debug << "-" << grid.right(); + debug << ","; + + debug << grid.top(); + if ( grid.height() > 1 ) + debug << "->" << grid.bottom(); + + debug << "]: "; + + if ( auto item = engine.itemAt( i ) ) + { + const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); + + debug << item->metaObject()->className() + << " w:" << constraint.width() << " h:" << constraint.height(); + } + else + { + const auto size = engine.spacerAt( i ); + debug << "spacer w:" << size.width() << " h:" << size.height(); + } + + debug << '\n'; + } +} + #include "moc_QskGridBox.cpp" diff --git a/src/layouts/QskGridBox.h b/src/layouts/QskGridBox.h index 35515a99..246f1c12 100644 --- a/src/layouts/QskGridBox.h +++ b/src/layouts/QskGridBox.h @@ -108,6 +108,8 @@ class QSK_EXPORT QskGridBox : public QskBox Q_INVOKABLE void setRowFixedHeight( int row, qreal height ); Q_INVOKABLE void setColumnFixedWidth( int column, qreal width ); + void dump(); + public Q_SLOTS: void invalidate(); void clear( bool autoDelete = false ); diff --git a/src/layouts/QskLinearBox.cpp b/src/layouts/QskLinearBox.cpp index f162c69a..6480d82e 100644 --- a/src/layouts/QskLinearBox.cpp +++ b/src/layouts/QskLinearBox.cpp @@ -532,4 +532,37 @@ int QskLinearBox::stretchFactor( const QQuickItem* item ) const return stretchFactor( indexOf( item ) ); } +void QskLinearBox::dump() +{ + const auto& engine = m_data->engine; + + auto debug = qDebug(); + + QDebugStateSaver saver( debug ); + debug.nospace(); + + const auto constraint = sizeConstraint(); + + debug << "QskLinearBox" << engine.orientation() + << " w:" << constraint.width() << " h:" << constraint.height() << '\n'; + + for ( int i = 0; i < engine.count(); i++ ) + { + debug << " " << i << ": "; + + if ( auto item = engine.itemAt( i ) ) + { + const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); + debug << item->metaObject()->className() + << " w:" << constraint.width() << " h:" << constraint.height(); + } + else + { + debug << "spacer: " << engine.spacerAt( i ); + } + + debug << '\n'; + } +} + #include "moc_QskLinearBox.cpp" diff --git a/src/layouts/QskLinearBox.h b/src/layouts/QskLinearBox.h index d0bbe3b3..59c962a0 100644 --- a/src/layouts/QskLinearBox.h +++ b/src/layouts/QskLinearBox.h @@ -88,6 +88,8 @@ class QSK_EXPORT QskLinearBox : public QskIndexedLayoutBox void setStretchFactor( const QQuickItem*, int stretchFactor ); int stretchFactor( const QQuickItem* ) const; + void dump(); + public Q_SLOTS: void transpose(); void activate(); diff --git a/src/layouts/QskStackBox.cpp b/src/layouts/QskStackBox.cpp index 452e2021..24a51afc 100644 --- a/src/layouts/QskStackBox.cpp +++ b/src/layouts/QskStackBox.cpp @@ -404,4 +404,33 @@ bool QskStackBox::event( QEvent* event ) return Inherited::event( event ); } +void QskStackBox::dump() +{ + auto debug = qDebug(); + + QDebugStateSaver saver( debug ); + debug.nospace(); + + const auto constraint = sizeConstraint(); + + debug << "QskStackBox" + << " w:" << constraint.width() << " h:" << constraint.height() << '\n'; + + for ( int i = 0; i < m_data->items.count(); i++ ) + { + const auto item = m_data->items[i]; + + debug << " " << i << ": "; + + const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); + debug << item->metaObject()->className() + << " w:" << constraint.width() << " h:" << constraint.height(); + + if ( i == m_data->currentIndex ) + debug << " [X]"; + + debug << '\n'; + } +} + #include "moc_QskStackBox.cpp" diff --git a/src/layouts/QskStackBox.h b/src/layouts/QskStackBox.h index 95082003..3c0bc9e8 100644 --- a/src/layouts/QskStackBox.h +++ b/src/layouts/QskStackBox.h @@ -55,6 +55,8 @@ class QSK_EXPORT QskStackBox : public QskIndexedLayoutBox QRectF geometryForItemAt( int index ) const; + void dump(); + Q_SIGNALS: void defaultAlignmentChanged( Qt::Alignment );