Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
None
-
5.4.0
-
None
-
b7738beda651c2927e1a9d58c592148b1dc99576
Description
A common problem for controls is that when the business logic is implemented in a C++ "base" type and the visual parts in a QML "sub" type, enum values provided by the C++ type cannot be accessed by the QML type name.
Example: a TextField control that inherits QQuickTextInput.
// TextField.qml
TextInput {
id: control
implicitWidth: ...
implicitHeight: ...
Rectangle {
id: background
z: -1
}
}
Application code cannot use eg. TextField.Password but must use TextInput.Password instead:
TextField { // echoMode: TextField.Password // "ReferenceError: TextField is not defined" // vs. echoMode: TextInput.Password // :( }
Attachments
Issue Links
- relates to
-
QTBUG-39607 Enum type of a alias is lost
-
- Open
-
-
QTBUG-43581 Attached properties declared in C++ base type
-
- Closed
-
For Gerrit Dashboard: QTBUG-43582 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
109309,3 | WIP: Enums declared in C++ base type | dev | qt/qtdeclarative | Status: DEFERRED | -2 | 0 |
125599,3 | WIP: qmlRegisterType(): allow specifying the base type for composite types | 5.6 | qt/qtdeclarative | Status: ABANDONED | -2 | 0 |
125617,11 | Make QML composite types inherit enums | 5.6 | qt/qtdeclarative | Status: MERGED | -2 | 0 |
125693,5 | Enums are now available using the QML composite type name | 5.6 | qt/qtquickcontrols2 | Status: MERGED | +2 | 0 |