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

No way to set disabled colour palette properties from QML

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.0
    • 6.0
    • Quick: Controls 2
    • None
    • All
    • 31f5c21ddb571d744efd1885c0687816b3a12225

    Description

      Using MenuItem as an example, the disabled windowText property of its palette is set in C++, but there's no way to set it from QML and hence no way to distinguish between the normal and disabled colours. This means that once you set windowText, you effectively override the disabled colour as well.

      The last item in the screenshot below should be the default (light greyish) disabled colour:

      import QtQuick 2.11
      import QtQuick.Controls 2.4
      import QtQuick.Window 2.2
      
      Window {
          id: window
          objectName: "window"
          width: 600
          height: 800
          visible: true
      
          Menu {
              visible: true
      
              MenuItem {
                  text: "Enabled, default palette"
              }
              MenuItem {
                  text: "Disabled, default palette"
                  enabled: false
              }
              MenuItem {
                  text: "Enabled, custom palette"
                  palette.windowText: "red"
              }
              MenuItem {
                  text: "Disabled, custom palette"
                  enabled: false
                  palette.windowText: "red"
              }
          }
      }
      

      One solution might be to add a "disabled" grouped property somehow:

          palette.windowText: "red"
          palette.disabled.windowText: "gray"
      

      Attachments

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

        Activity

          People

            vitaly.fanaskov Vitaly Fanaskov
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes