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

Consolidate QML SystemPalette and QML Palette API

    XMLWordPrintable

Details

    Description

      https://doc.qt.io/qt-6/qml-qtquick-systempalette.html is quite a different API compared to https://doc.qt.io/qt-6/qml-qtquick-palette.html Plus, the SystemPalette has had unfilled gaps for years (see the sub-tasks under QTBUG-111705 )

      The learning curve would be reduced, maintenance would be simplified, and future gaps would be avoided if both APIs were consolidated.

       

      Possible approach

      Turn SystemPalette into an Attached Property that provides read-only access to an underlying Palette object

      Current example at https://doc.qt.io/qt-6/qml-qtquick-systempalette.html#details :

      import QtQuick 2.0
      
      Rectangle {
          SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
      
          width: 640; height: 480
          color: myPalette.window
      
          Text {
              anchors.fill: parent
              text: "Hello!"; color: myPalette.windowText
          }
      }
      

       

      Consolidated version:

      import QtQuick
      
      Rectangle {
          width: 640; height: 480
          color: SystemPalette.active.window
      
          Text {
              anchors.fill: parent
              text: "Hello!"; color: SystemPalette.active.windowText
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              skoh-qt Sze Howe Koh
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes