Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
None
-
4.7.2
-
None
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
- replaces
-
QTBUG-22065 string/color comparisons are unintuitive
- Closed
For Gerrit Dashboard: QTBUG-18754 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
30164,8 | Allow color to be explicitly compared to a string | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |