QuickWidget Class
The QuickWidget loads QML and supports language switching in runtime More...
| Header: | #include <QuickWidget> |
Public Functions
| QuickWidget(QWidget *parent = nullptr) |
Protected Functions
| void | changeEvent(QEvent *event) |
Detailed Description
The QuickWidget loads QML and supports language switching in runtime
To ensure that texts get retranslated in runtime, the QML needs to add cdpTr.emptyString to translatable strings:
Text { text: qsTr("Hello world!") + cdpTr.emptyString }
The QML can also change the language using the cdpTr object:
Text {
text: "Click to set english language!"
MouseArea {
anchors.fill: parent
onPressed: { cdpTr.setTranslation("english"); }
}
}
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.