Solved Access UI from QML
-
Hey,
I'm trying to access UI elements from my QML script:
For example accessing bt_start in the forms qml
UI QML:
Item {
width: 800
visible: trueColumn { id: column x: 0 y: 0 width: 800 height: 480 spacing: 0 GroupBox { id: g_Preferences width: 800 height: 120 spacing: -5 clip: false title: qsTr("Preferences") Column { id: column2 width: 776 height: 100 spacing: 1 Row { id: row3 width: 800 height: 30 spacing: 20 Button { id: bt_start height: 20 text: qsTr("Start") anchors.verticalCenter: parent.verticalCenter }
QML:
Window
{
width: 800
height: 320MyForm { id: qFrom } Connections { onQmlSetDaemonEnabled(enabled) { bt_start.enabled: enabled //bt_start not found } }
bt_start.enabled: enabled error: bt_start is not defined
using the form:
qForm.bt_start error: TypeError: Type error
can anyone help?
I've only found those solution on stack and qt
-
ok it seems like i had to export it in QT Creator which generates an property alias for the object