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

Create contentItem lazily where possible

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.7.0
    • Fix Version/s: 5.8.0 Beta
    • Component/s: Quick: Controls 2
    • Labels:
      None
    • Commits:
      0e3636a4692c9cf89d994f3fe5c1c110b4c6ee61

      Description

      Container controls such as Pane and its subclasses should create the default content item lazily, instantiating it only if needed. Now they all have declared an empty item in QML:

      contentItem: Item { }
      

      just to ensure that the default property contentData has always an item to forward the data to. However, the default content item is unnecessarily created when someone writes:

      Pane {
          contentItem: ColumnLayout {
              ...
          }
      }
      

      Affected controls:

      $ git grep "contentItem: Item { }" 
      src/imports/controls/Drawer.qml:    contentItem: Item { }
      src/imports/controls/Frame.qml:    contentItem: Item { }
      src/imports/controls/GroupBox.qml:    contentItem: Item { }
      src/imports/controls/Page.qml:    contentItem: Item { }
      src/imports/controls/Pane.qml:    contentItem: Item { }
      src/imports/controls/Popup.qml:    contentItem: Item { }
      src/imports/controls/ToolBar.qml:    contentItem: Item { }
      src/imports/controls/material/Drawer.qml:    contentItem: Item { }
      src/imports/controls/material/Frame.qml:    contentItem: Item { }
      src/imports/controls/material/Page.qml:    contentItem: Item { }
      src/imports/controls/material/Pane.qml:    contentItem: Item { }
      src/imports/controls/material/Popup.qml:    contentItem: Item { }
      src/imports/controls/material/ToolBar.qml:    contentItem: Item { }
      src/imports/controls/universal/Drawer.qml:    contentItem: Item { }
      src/imports/controls/universal/Frame.qml:    contentItem: Item { }
      src/imports/controls/universal/GroupBox.qml:    contentItem: Item { }
      src/imports/controls/universal/Page.qml:    contentItem: Item { }
      src/imports/controls/universal/Pane.qml:    contentItem: Item { }
      src/imports/controls/universal/Popup.qml:    contentItem: Item { }
      src/imports/controls/universal/ToolBar.qml:    contentItem: Item { }
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jpnurmi J-P Nurmi
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes