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

The hex color code works when changing colors when we click , but the color id doesnt

    XMLWordPrintable

Details

    Description

      Use this code snippet,

      import Qt 4.7
      
      Rectangle {
          width: 800
          height: 480
          Rectangle{
              id:rect
              width:50;height:50
              pos.x: 10
              pos.y:10
              radius:10
              color:"red";
          }
      
          Text {
              id: text1
              text: "Hello World"
              color: "red"
              anchors.centerIn: parent
              MouseArea{
                  anchors.fill: parent
                  onClicked: {
                      console.log("Clicked"+text1.color); 
                      // This works 
                      text1.color =(text1.color=="#ff0000"?"#008000":"#ff0000") 
                      rect.color =(rect.color=="#ff0000"?"#008000":"#ff0000")
      
                      // This doesnt work
      //                text1.color =(text1.color=="red"?"green":"red")
      //                rect.color =(rect.color=="red"?"green":"red")
                  }
              }
          }
      }
      

      On clicking the text, it changes color when colors are used in hex codes but not when using color id. Looks like a bug to me.

      Attachments

        Issue Links

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

          Activity

            People

              mvogt Matthew Vogt (closed Nokia identity) (Inactive)
              tapadar Indrajit Tapadar (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes