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. ui.qml -> qml actions
Forum Updated to NodeBB v4.3 + New Features

ui.qml -> qml actions

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 707 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.
  • gfxxG Offline
    gfxxG Offline
    gfxx
    wrote on last edited by gfxx
    #1

    I'm beginner in qt quick world ... inside a swipeWiev i have a layout with row and column with some delay button and statusindicator like these (myfile.ui.qml):

    /* gui ui.qml file */
                                Column {
                                    id: column
                                    spacing: 15
    
                                    
                                    DelayButton {
                                        id: onDelBnt1
                                        x: 0
                                        width: 100
                                        height: 100
                                        text: qsTr("press the button!")
    
    
                                    }
    
                                    StatusIndicator {
                                        id: statusIndicator
                                        x: 34
                                        width: 34
                                        height: 34
                                        color: "#0f8241"
    
                                    }
    
    
    
                                }
    

    javascript block is not enabled in ui file, and not understand how i can insert the function on myMain.qml file .... I tru property alias mechanism but fail .....
    I want to press the button and after delay put in on state the status indicator ..... is quite simple but never try ....
    I'm on qt5.11 qtquick.control2

    regards

    bkt

    ODБOïO 1 Reply Last reply
    0
    • gfxxG gfxx

      I'm beginner in qt quick world ... inside a swipeWiev i have a layout with row and column with some delay button and statusindicator like these (myfile.ui.qml):

      /* gui ui.qml file */
                                  Column {
                                      id: column
                                      spacing: 15
      
                                      
                                      DelayButton {
                                          id: onDelBnt1
                                          x: 0
                                          width: 100
                                          height: 100
                                          text: qsTr("press the button!")
      
      
                                      }
      
                                      StatusIndicator {
                                          id: statusIndicator
                                          x: 34
                                          width: 34
                                          height: 34
                                          color: "#0f8241"
      
                                      }
      
      
      
                                  }
      

      javascript block is not enabled in ui file, and not understand how i can insert the function on myMain.qml file .... I tru property alias mechanism but fail .....
      I want to press the button and after delay put in on state the status indicator ..... is quite simple but never try ....
      I'm on qt5.11 qtquick.control2

      regards

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      hi
      @gfxx said in ui.qml -> qml actions:

      I tru property alias mechanism but fail .....

      what failed with this https://doc.qt.io/qtcreator/creator-quick-ui-forms.html ?

      gfxxG 1 Reply Last reply
      0
      • ODБOïO ODБOï

        hi
        @gfxx said in ui.qml -> qml actions:

        I tru property alias mechanism but fail .....

        what failed with this https://doc.qt.io/qtcreator/creator-quick-ui-forms.html ?

        gfxxG Offline
        gfxxG Offline
        gfxx
        wrote on last edited by
        #3

        @LeLev ```
        /ui.qml/
        page{
        x:10
        y:10
        property alias mydelayButton: mydelayButton
        .......

        /mymain.qml/

           mydelayButton: messageDialog.show(qsTr("Button pressed"))  
        
        
        the debugger said: error! mybutton alias read only property

        bkt

        1 Reply Last reply
        0
        • gfxxG Offline
          gfxxG Offline
          gfxx
          wrote on last edited by
          #4

          ok ok ... from ui.qml file in design mode (opposite to text mode)

          • hover the component
          • right click on mouse
          • menù "go to implementation" or " new signal handler"

          than in main.qml file, somethings like these:

                      function changePos(){
                          if(delayBnt1.checked){
                              statusIndicator.active = false
                              console.log(qsTr("Button pressed"))
                          }
                          else{
                              statusIndicator.active = true
                              console.log(qsTr("Button RELEASED"))
                          }
          
                      }
          
                      function enableCmd(){
                          if(togBtn.checked){
                              groupBox1.enabled = true
                              console.log(qsTr("group box enabled"))
                          }
                          else{
                              groupBox1.enabled = false
                              console.log(qsTr("group box DISABLE"))
                          }
                      }
          
                      delayBnt1.onCheckedChanged: changePos()
                      togBtn.onCheckedChanged: enableCmd()
          

          There is a way to do these with less rows of code?

          regards

          bkt

          1 Reply Last reply
          0

          • Login

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