Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-15863

QDeclarativeView SizeRootObjectToView still resizes view

    XMLWordPrintable

Details

    • 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.

      http://qt.gitorious.org/qt/qt/merge_requests/965

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            david@fries.net David Fries
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes