dump method added
This commit is contained in:
parent
4e4b440a09
commit
5b094af452
|
@ -7,6 +7,7 @@
|
||||||
#include "QskGridLayoutEngine.h"
|
#include "QskGridLayoutEngine.h"
|
||||||
#include "QskEvent.h"
|
#include "QskEvent.h"
|
||||||
#include "QskQuick.h"
|
#include "QskQuick.h"
|
||||||
|
#include <qdebug.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
static void qskSetItemActive( QObject* receiver, const QQuickItem* item, bool on )
|
static void qskSetItemActive( QObject* receiver, const QQuickItem* item, bool on )
|
||||||
|
@ -470,4 +471,53 @@ bool QskGridBox::event( QEvent* event )
|
||||||
return Inherited::event( 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"
|
#include "moc_QskGridBox.cpp"
|
||||||
|
|
|
@ -108,6 +108,8 @@ class QSK_EXPORT QskGridBox : public QskBox
|
||||||
Q_INVOKABLE void setRowFixedHeight( int row, qreal height );
|
Q_INVOKABLE void setRowFixedHeight( int row, qreal height );
|
||||||
Q_INVOKABLE void setColumnFixedWidth( int column, qreal width );
|
Q_INVOKABLE void setColumnFixedWidth( int column, qreal width );
|
||||||
|
|
||||||
|
void dump();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void invalidate();
|
void invalidate();
|
||||||
void clear( bool autoDelete = false );
|
void clear( bool autoDelete = false );
|
||||||
|
|
|
@ -532,4 +532,37 @@ int QskLinearBox::stretchFactor( const QQuickItem* item ) const
|
||||||
return stretchFactor( indexOf( item ) );
|
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"
|
#include "moc_QskLinearBox.cpp"
|
||||||
|
|
|
@ -88,6 +88,8 @@ class QSK_EXPORT QskLinearBox : public QskIndexedLayoutBox
|
||||||
void setStretchFactor( const QQuickItem*, int stretchFactor );
|
void setStretchFactor( const QQuickItem*, int stretchFactor );
|
||||||
int stretchFactor( const QQuickItem* ) const;
|
int stretchFactor( const QQuickItem* ) const;
|
||||||
|
|
||||||
|
void dump();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void transpose();
|
void transpose();
|
||||||
void activate();
|
void activate();
|
||||||
|
|
|
@ -404,4 +404,33 @@ bool QskStackBox::event( QEvent* event )
|
||||||
return Inherited::event( 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"
|
#include "moc_QskStackBox.cpp"
|
||||||
|
|
|
@ -55,6 +55,8 @@ class QSK_EXPORT QskStackBox : public QskIndexedLayoutBox
|
||||||
|
|
||||||
QRectF geometryForItemAt( int index ) const;
|
QRectF geometryForItemAt( int index ) const;
|
||||||
|
|
||||||
|
void dump();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void defaultAlignmentChanged( Qt::Alignment );
|
void defaultAlignmentChanged( Qt::Alignment );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue