C

SafeMessage QML Type

Provides a message interface for sending messages from QML runtime to QSR process. More...

Import Statement: import Qt.SafeRenderer 2.0

Methods

Detailed Description

Method Documentation

void changeItemVisiblity(const QString&id, bool enable)

Hide or show 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(const QString&layoutId)

Change 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 moveItem(const QString&itemId, const QPointF&pos)

Change the item position in Qt Safe Renderer runtime. itemId is the QML Item's id. pos the new position.


void sendHeartBeat(const 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(const QString&itemId, const QString&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(const QString&itemId, const QString&text)

Sets the text of the SateText item specified by itemId to text in the Qt Safe Renderer runtime.


Available under certain Qt licenses.
Find out more.