Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.15.2
-
None
Description
Currently one can build a color in QML from
- (a QColor in C++)
- a string representing a SVG color name
- a string in hash+hexadecimal (#RRGGBB)
- a construction function like Qt.rgba()
A direct conversion from the Qt::GlobalColor enumeration is missing, although the enumerators themselves are exposed to QML:
Rectangle {
color: Qt.red // ERROR: no int -> color conversion
}
The error shows that the problem is deeper than a mere "conversion" but has to do with the messed-up state of enumerations in QML (sometimes being integers, sometimes being enumerations).
While at it, it would be niceā¢ to have the color constants in QColorConstants exposed in QML as named objects, avoiding the risk of typos and the cost of parsing a string.
Attachments
Issue Links
- relates to
-
QTBUG-110359 Add pre-defined color constants just like QColorConstants
- Reported