Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.2.1
-
None
-
Ubuntu 12.04 64-bit
-
qtdeclarative: 0b2d05093c6fc030d40be8c873ad1e0af9bba8cc
Description
We have a control that reparents itself to the root item (window's contentItem) when it's opened. This seems to work fine, but the unit tests fail because the root item has a zero width and height.
#include <QtCore> #include <QtQuick> int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); QQmlEngine engine; QQuickWindow window; window.setWidth(400); window.setHeight(400); QQmlComponent component(&engine); component.setData(QByteArray("import QtQuick 2.0\n Rectangle { color: 'red'; anchors.fill: parent }"), QUrl()); QObject *object = component.create(); qobject_cast<QQuickItem*>(object)->setParentItem(window.contentItem()); qDebug() << object << window.contentItem()->width() << window.contentItem()->height(); window.show(); return app.exec(); }
QQuickRectangle(0x1c10490) 0 0
Moving the initContentItem() call to the end of QQuickWindowPrivate::init(QQuickWindow *c) seems to be a workaround.
Attachments
Issue Links
- relates to
-
QTBUG-49912 Qt 5.6/Linux: tst_qquickwindow::contentItemSize() fails
-
- Closed
-
For Gerrit Dashboard: QTBUG-36938 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
78944,3 | QQuickWindow: fix content item size | stable | qt/qtdeclarative | Status: MERGED | +2 | 0 |
79281,1 | Revise tst_applicationwindow | stable | qt/qtquickcontrols | Status: MERGED | +2 | 0 |
79373,1 | Fix tst_qquicktext::hover() | stable | qt/qtdeclarative | Status: MERGED | +2 | 0 |