qskSetItemGeometry added
This commit is contained in:
parent
5447aa30fa
commit
de6ab7f7aa
@ -54,6 +54,19 @@ QRectF qskItemGeometry( const QQuickItem* item )
|
|||||||
return QRectF( d->x, d->y, d->width, d->height );
|
return QRectF( d->x, d->y, d->width, d->height );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qskSetItemGeometry( QQuickItem* item, const QRectF& rect )
|
||||||
|
{
|
||||||
|
if ( auto control = qobject_cast< QskControl* >( item ) )
|
||||||
|
{
|
||||||
|
control->setGeometry( rect );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item->setPosition( rect.topLeft() );
|
||||||
|
item->setSize( rect.size() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool qskIsItemComplete( const QQuickItem* item )
|
bool qskIsItemComplete( const QQuickItem* item )
|
||||||
{
|
{
|
||||||
return QQuickItemPrivate::get( item )->componentComplete;
|
return QQuickItemPrivate::get( item )->componentComplete;
|
||||||
@ -270,7 +283,7 @@ Q_GLOBAL_STATIC( QskControlRegistry, qskRegistry )
|
|||||||
|
|
||||||
class QskControlPrivate final : public QQuickItemPrivate
|
class QskControlPrivate final : public QQuickItemPrivate
|
||||||
{
|
{
|
||||||
Q_DECLARE_PUBLIC(QskControl)
|
Q_DECLARE_PUBLIC( QskControl )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QskControlPrivate():
|
QskControlPrivate():
|
||||||
@ -309,7 +322,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mirrorChange() override
|
virtual void mirrorChange() override final
|
||||||
{
|
{
|
||||||
Q_Q( QskControl );
|
Q_Q( QskControl );
|
||||||
qskSendEventTo( q, QEvent::LayoutDirectionChange );
|
qskSendEventTo( q, QEvent::LayoutDirectionChange );
|
||||||
@ -540,6 +553,11 @@ void QskControl::setGeometry( qreal x, qreal y, qreal width, qreal height )
|
|||||||
if ( dirtyType & QQuickItemPrivate::Size )
|
if ( dirtyType & QQuickItemPrivate::Size )
|
||||||
d->dirty( QQuickItemPrivate::Size );
|
d->dirty( QQuickItemPrivate::Size );
|
||||||
|
|
||||||
|
/*
|
||||||
|
Unfortunately geometryChanged is protected and we can't implement
|
||||||
|
this code as qskSetItemGeometry - further hacking required: TODO ...
|
||||||
|
*/
|
||||||
|
|
||||||
geometryChanged( QRectF( d->x, d->y, d->width, d->height ), oldRect );
|
geometryChanged( QRectF( d->x, d->y, d->width, d->height ), oldRect );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1419,10 +1437,7 @@ void QskControl::updatePolish()
|
|||||||
for ( auto child : children )
|
for ( auto child : children )
|
||||||
{
|
{
|
||||||
if ( !QQuickItemPrivate::get( child )->isTransparentForPositioner() )
|
if ( !QQuickItemPrivate::get( child )->isTransparentForPositioner() )
|
||||||
{
|
qskSetItemGeometry( child, rect );
|
||||||
child->setPosition( rect.topLeft() );
|
|
||||||
child->setSize( rect.size() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +253,10 @@ QSK_EXPORT bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem *child
|
|||||||
QSK_EXPORT bool qskIsTransparentForPositioner( const QQuickItem* );
|
QSK_EXPORT bool qskIsTransparentForPositioner( const QQuickItem* );
|
||||||
QSK_EXPORT bool qskIsTabFence( const QQuickItem* );
|
QSK_EXPORT bool qskIsTabFence( const QQuickItem* );
|
||||||
QSK_EXPORT bool qskIsShortcutScope( const QQuickItem* );
|
QSK_EXPORT bool qskIsShortcutScope( const QQuickItem* );
|
||||||
|
|
||||||
QSK_EXPORT QRectF qskItemRect( const QQuickItem* );
|
QSK_EXPORT QRectF qskItemRect( const QQuickItem* );
|
||||||
QSK_EXPORT QRectF qskItemGeometry( const QQuickItem* );
|
QSK_EXPORT QRectF qskItemGeometry( const QQuickItem* );
|
||||||
|
QSK_EXPORT void qskSetItemGeometry( QQuickItem*, const QRectF& );
|
||||||
|
|
||||||
QSK_EXPORT QQuickItem* qskNearestFocusScope( const QQuickItem* );
|
QSK_EXPORT QQuickItem* qskNearestFocusScope( const QQuickItem* );
|
||||||
QSK_EXPORT QList<QQuickItem *> qskPaintOrderChildItems( const QQuickItem* );
|
QSK_EXPORT QList<QQuickItem *> qskPaintOrderChildItems( const QQuickItem* );
|
||||||
|
@ -73,6 +73,7 @@ namespace
|
|||||||
QCoreApplication::postEvent( window, new QEvent( QEvent::LayoutRequest ) );
|
QCoreApplication::postEvent( window, new QEvent( QEvent::LayoutRequest ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQuickItem* m_item;
|
QQuickItem* m_item;
|
||||||
};
|
};
|
||||||
@ -423,16 +424,13 @@ void QskWindow::layoutItems()
|
|||||||
if ( !d->autoLayoutChildren )
|
if ( !d->autoLayoutChildren )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QSizeF sz( contentItem()->width(), contentItem()->height() );
|
const QRectF rect = qskItemGeometry( contentItem() );
|
||||||
|
|
||||||
const auto children = contentItem()->childItems();
|
const auto children = contentItem()->childItems();
|
||||||
for ( auto child : children )
|
for ( auto child : children )
|
||||||
{
|
{
|
||||||
if ( !qskIsTransparentForPositioner( child ) )
|
if ( !qskIsTransparentForPositioner( child ) )
|
||||||
{
|
qskSetItemGeometry( child, rect );
|
||||||
child->setPosition( contentItem()->position() );
|
|
||||||
child->setSize( sz );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,8 +168,7 @@ void QskLayoutItem::setGeometry( const QRectF& rect )
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_isGeometryDirty = false;
|
m_isGeometryDirty = false;
|
||||||
m_item->setPosition( rect.topLeft() );
|
qskSetItemGeometry( m_item, rect );
|
||||||
m_item->setSize( rect.size() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskLayoutItem::hasDynamicConstraint() const
|
bool QskLayoutItem::hasDynamicConstraint() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user