Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.1
-
None
-
Linux, X11, Qt4.6 and 4.7, Fvwm
-
daf6a270888d2f70e57a838d0ba4adae954c3d22 (qt/tqtc-qtdeclarative/5.12.0)
Description
QDeclarativeView has two resizing modes, SizeViewToRootObject "The view resizes with the root item in the QML." and SizeRootObjectToView "The view will automatically resize the root item to the size of the view." They sound like they define which is resized to which and are opposite in which one is resized. The bug is both are resizing the view to the size of the root item. SizeViewToRootObject should, but SizeRootObjectToView being the opposite shouldn't, but it will when the root item is loaded (or reloaded). This patch adds a check in QDeclarativeView::setRootObject to only resize the view if the resize mode is set to SizeViewToRootObject, otherwise there isn't a way to keep the window from resizing and using setSource doesn't allow getting at the loaded root item modify the root size before the resize happens automatically.
Without this patch you can't keep the QML from resizing the window, with it the resize mode controls if it gets resized or not. If the application wants QML to resize the view, set SizeViewToRootObject (which is the default) when the QML is loaded, or use initialSize() after the load to find out what size QML requested and resize to that.
In my case I have a QDeclarativeView top level window with a QGLWidget for the viewport. It has QML UI over an OpenGL drawn scene and never needs to be resized to the QML root object, but is being resized each time the QML is reloaded and the extra QML startup resize is interacting badly with the initial full screen startup.
Attachments
For Gerrit Dashboard: QTBUG-15863 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
2132,2 | QDeclarativeView/QSGView SizeRootObjectToView still resizes view | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |