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

Create contentItem lazily where possible

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.8.0 Beta
    • 5.7.0
    • Quick: Controls 2
    • None
    • 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

          For Gerrit Dashboard: QTBUG-56038
          # Subject Branch Project Status CR V

          Activity

            People

              Unassigned Unassigned
              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