C
SafeMessage QML Type
Provides a message interface for sending messages from QML runtime to QSR process. More...
| Import Statement: | import Qt.SafeRenderer |
Methods
- void changeItemVisiblity(string id, bool enable)
- void changeLayout(string layoutId)
- void changeState(string id, string state)
- void moveItem(string itemId, point pos)
- void sendHeartBeat(int timeout)
- void setColor(string itemId, string colorStr)
- void setText(string itemId, string text)
Detailed Description
Method Documentation
void changeItemVisiblity(string id, bool enable)
Hides or shows the items visibility in Qt Safe Renderer runtime. id is the QML Item's id. enable true shows the item, false hides the item.
void changeLayout(string layoutId)
Changes the layout in Qt Safe Renderer runtime. layoutId is the id of the layout. The layout id must be set accordingly in Qt Safe Renderer runtime.
You can send the changeLayout event from the Qt Quick runtime to the QSR as follows:
onStateChanged: {
if (state == "sports")
SafeMessage.changeLayout("sport")
else
SafeMessage.changeLayout("hybrid")
}layoutId values must match with the layout ids in main.cpp in the Telltales example:
static QSafeLayoutResourceReader layoutHybrid("/qtcluster/layoutData/DashboardForm.ui.srl"); const quint32 layoutHybridID = qsafe_hash("hybrid", safe_strlen("hybrid")); const quint32 layoutSportID = qsafe_hash("sport", safe_strlen("sport")); layoutHybrid.setLayoutId(layoutHybridID); static QSafeLayoutResourceReader layoutSport("/qtcluster/layoutData/DashboardSportForm.ui.srl"); layoutSport.setLayoutId(layoutSportID);
void changeState(string id, string state)
Changes the state in Qt Safe Renderer runtime. id is the id of the root state. state is the state name in your qml file you want to change to.
You can send the changeState event from the Qt Quick runtime to the QSR with button for example as follows:
onClicked: SafeMessage.changeState("root","changeStateTo")
void moveItem(string itemId, point pos)
Changes the item position in Qt Safe Renderer runtime. itemId is the QML Item's id. pos the new position.
void sendHeartBeat(int timeout)
Sends a heartbeat message to the Qt Safe Renderer process. timeout is the value Qt Safe Renderer process shall wait for next heartbeat message.
void setColor(string itemId, string colorStr)
Sets the text color of the SafeText item itemId to colorStr. The color is set as an RGB value in one of the following formats:
- #RGB (each of R, G, and B is a single hex digit)
- #RRGGBB
- #AARRGGBB
- #RRRGGGBBB
- #RRRRGGGGBBBB
- A name from the list of colors defined in the list of Extended color keywords provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro". These color names work on all platforms. Note that these color names are not the same as defined by the Qt.GlobalColor enums, e.g. "green" and Qt::green do not refer to the same color.
- transparent - representing the absence of a color.
The text color is invalid if colorStr cannot be parsed.
void setText(string itemId, string text)
Sets the text of the SafeText item specified by itemId to text in the Qt Safe Renderer runtime.
Available under certain Qt licenses.
Find out more.