Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Access UI from QML

Access UI from QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 460 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Slei
    wrote on last edited by
    #1

    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: true

    Column {
        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: 320

    MyForm
    {
     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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Slei
      wrote on last edited by
      #2

      ok it seems like i had to export it in QT Creator which generates an property alias for the object

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved