Basic qml label update with cpp
Unsolved
General and Desktop
-
Hey guys,
i have a pretty simple question but i dont find a solution:
I want to update this qml component when the property ACSQmlTool.linkTool.isConnected changes:
Label { id: connectionLost text: ACSQmlTool.linkTool.isConnected ? qsTr("Link connected!") : qsTr("Link disconnected") font.pointSize: ScreenTools.defaultFontPointSize font.family: ScreenTools.normalFontFamily font.weight: Font.Normal color: ACSQmlTool.linkTool.isConnected ? ACSPalette.lightblueLight : ACSPalette.orange visible: ACSQmlTool.linkTool.isConnected }
Unfortunately it doesn't change even if the property changes.
-
LinkTool:
class ACSLinkTool : public ACSAbstractTool { Q_OBJECT public: ACSLinkTool(ACSApplication* app, ACSToolbox* toolbox); ~ACSLinkTool(); Q_PROPERTY(bool isBluetoothAvailable READ isBluetoothAvailable CONSTANT) Q_PROPERTY(ACSQmlListModel* linkConfigurations READ _qmlLinkConfigurations NOTIFY linkConfigurationsChanged) Q_PROPERTY(QStringList linkTypeStrings READ linkTypeStrings CONSTANT) Q_PROPERTY(QStringList serialBaudRates READ serialBaudRates CONSTANT) Q_PROPERTY(QStringList serialPortStrings READ serialPortStrings NOTIFY commPortStringsChanged) Q_PROPERTY(QStringList serialPorts READ serialPorts NOTIFY commPortsChanged) Q_PROPERTY(bool isConnected READ isConnected NOTIFY isConnectedChanged)
QmlTool:
qmlRegisterSingletonType <ACSQmlTool> ("ACSCpp.Qml", 1, 0, "ACSQmlTool", qmlToolSingletonFactory);
isConnected is directly changed in the code for debug purposes.