qtquick: Fix user geometry not being honoured

QtQuick doesn't set Qt::WA_Moved, which we expect. Set this attribute
in the wrappers then.

Fixes the unit-test too.
This commit is contained in:
Sergio Martins
2020-10-10 11:46:24 +01:00
parent 9a88cf3a72
commit c175451284
3 changed files with 18 additions and 4 deletions

View File

@@ -141,8 +141,7 @@ void QWidgetAdapter::setGeometry(QRect rect)
{
setWidth(rect.width());
setHeight(rect.height());
setX(rect.x());
setY(rect.y());
move(rect.topLeft());
}
void QWidgetAdapter::grabMouse()
@@ -254,6 +253,19 @@ QPoint QWidgetAdapter::mapTo(const QQuickItem *parent, const QPoint &pos) const
return parent->mapFromGlobal(QQuickItem::mapToGlobal(pos)).toPoint();
}
bool QWidgetAdapter::testAttribute(Qt::WidgetAttribute attr) const
{
return m_widgetAttributes & attr;
}
void QWidgetAdapter::setAttribute(Qt::WidgetAttribute attr, bool enable)
{
if (enable)
m_widgetAttributes |= attr;
else
m_widgetAttributes &= ~attr;
}
void QWidgetAdapter::setWindowTitle(const QString &title)
{
if (QWindow *window = windowHandle())
@@ -290,6 +302,7 @@ void QWidgetAdapter::move(int x, int y)
{
setX(x);
setY(y);
setAttribute(Qt::WA_Moved);
}
void QWidgetAdapter::setParent(QQuickItem *p)