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

QML Page costomization

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.5.5
    • Quick: Controls 2
    • None

      Hi everyone,

      I have a question regarding the customization of Controls in QtQuick, more specifically a `Page`.  
      In the documentation [here](https://doc.qt.io/Qt-6/qtquickcontrols-customize.html#customizing-a-control), under Avoid assigning an id to styles' implementations of item delegates, it states:

      "This technique relies on the absence of an id in the style's implementation of that item. If an id is assigned, the technique cannot work, and both items will be created. For example, it can be tempting to assign an id to the background or contentItem so that other objects within the file can refer to those items:"

      I fully understand this code example and try to apply it as much as possible in my custom Controls:

      ```qml
      T.Button {
          // ...

          background: Rectangle

      {         id: backgroundRect         // ...     }

          contentItem: Text

      {         // Use backgroundRect in some way...     }

          // ...
      }
      ```

      However, my issue arises when customizing a QML `Page` (which inherits from Controls). Does this technique also apply to `header` and `footer`? Because when debugging with the QML Profiler, I can see that the `header` declared in the base `CustomPage` is always created, despite the fact that I use another one higher in my component hierarchy.

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            romain.donze Romain Donzé
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes