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

The "Control" can't inherit the palette of "ApplicationWindow"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.4.0 RC1
    • 6.3.0 Beta2
    • Quick: Controls 2
    • None
    • All
    • c135dbf522 (qt/qtdeclarative/6.4) 2483ffa011 (qt/qtdeclarative/dev) c135dbf522 (qt/tqtc-qtdeclarative/6.4) 2483ffa011 (qt/tqtc-qtdeclarative/dev)

    Description

      In the follows code, when i clicked the button, it's background is not change, but it should follow the left Rectangle to change to blue.

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.0
      
      ApplicationWindow {
          id: window
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          palette {
              window: "white"
              windowText: "red"
          }
      
          Row {
              anchors.centerIn: parent
              spacing: 10
      
              Rectangle {
                  width: 100
                  height: 100
                  color: window.palette.windowText
                  Text {
                      anchors.centerIn: parent
                      text: "Window"
                      color: "white"
                  }
              }
      
              Button {
                  width: 100
                  height: 100
                  enabled: false
                  text: "Button"
                  palette.window: "yellow"
      
                  background: Rectangle {
                      color: parent.palette.windowText
                  }
      
                  Timer {
                      id: updateTheControlPalette
                      interval: 500
                      running: true
                      onTriggered: {
                          // If set the palette of the Button in there, then it's "windowText"
                          // color will can't follow the window's palette
                          parent.palette.window = "red"
                          parent.enabled = true
                      }
                  }
      
                  onClicked: {
                      window.palette.windowText = "blue"
                  }
              }
          }
      }
      
      

      Attachments

        1. for-qt5.patch
          7 kB
        2. test.palette.tar
          8 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vhilshei Volker Hilsheimer
            zccrs JiDe Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes