Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. qml sequential
Forum Updated to NodeBB v4.3 + New Features

qml sequential

Scheduled Pinned Locked Moved Unsolved Qt for Python
6 Posts 3 Posters 579 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Abdulrahman
    wrote on last edited by
    #1

    Hello All,
    The following are two python classes called by qml file. I want to make the first class implement first when condition is True and after it finish the second class start. How to make this in qml (in another meaning running two statements sequentially) 93d787d6-f36e-46e2-bfed-3c3440a3f2f0-image.png

    eyllanescE ODБOïO 2 Replies Last reply
    0
    • A Abdulrahman

      Hello All,
      The following are two python classes called by qml file. I want to make the first class implement first when condition is True and after it finish the second class start. How to make this in qml (in another meaning running two statements sequentially) 93d787d6-f36e-46e2-bfed-3c3440a3f2f0-image.png

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @Abdulrahman Your question is not clear so you must give more details in addition to providing a minimal and verifiable example

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      A 1 Reply Last reply
      0
      • A Abdulrahman

        Hello All,
        The following are two python classes called by qml file. I want to make the first class implement first when condition is True and after it finish the second class start. How to make this in qml (in another meaning running two statements sequentially) 93d787d6-f36e-46e2-bfed-3c3440a3f2f0-image.png

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

        hi

        @Abdulrahman said in qml sequential:

        and after it finish the second class start

        Add a signal to your first class and call it within the method
        Connect that signal to second class method
        https://wiki.qt.io/Qt_for_Python_Signals_and_Slots

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

          hi

          @Abdulrahman said in qml sequential:

          and after it finish the second class start

          Add a signal to your first class and call it within the method
          Connect that signal to second class method
          https://wiki.qt.io/Qt_for_Python_Signals_and_Slots

          A Offline
          A Offline
          Abdulrahman
          wrote on last edited by
          #4

          @LeLev the first class inside if condition so it will not be called all the time but the second class will be. So adding signal will help when first class be called but when it is not, it will not.

          1 Reply Last reply
          0
          • eyllanescE eyllanesc

            @Abdulrahman Your question is not clear so you must give more details in addition to providing a minimal and verifiable example

            A Offline
            A Offline
            Abdulrahman
            wrote on last edited by
            #5

            @eyllanesc In qml how to prevent red rectangle from showing except after Ok button inside the dialog clicked and if the dialog didn't open(due to not achieving the condition) the red rectangle shows(making block of the code goes sequential instead of parallel)

            2bfee7cb-9105-4f9f-93a7-d2d5a6917e95-image.png

            Code for main Window:

            import QtQuick 2.13
            import QtQuick.Window 2.13
            import QtQuick.Controls 2.0
            
            Window {
                width: 640
                height: 480
                visible: true
                title: qsTr("Hello World")
                SaveDialog{id: save}
                onXChanged: {
                    save.open()
                }
                Rectangle{
                    width: 200
                    height: 200
                    color: 'red'
                    Text {
                        text: qsTr("Two")
                    }
                }
            }
            
            

            Code for The Dialog:

            import QtQuick 2.12
            import QtQuick.Layouts 1.12
            import QtQuick.Dialogs 1.2
            import QtQuick.Controls 2.0
            
            Dialog{
                id: dialog
                width: 200
                height: 100
                title: "One"
            }
            
            
            eyllanescE 1 Reply Last reply
            0
            • A Abdulrahman

              @eyllanesc In qml how to prevent red rectangle from showing except after Ok button inside the dialog clicked and if the dialog didn't open(due to not achieving the condition) the red rectangle shows(making block of the code goes sequential instead of parallel)

              2bfee7cb-9105-4f9f-93a7-d2d5a6917e95-image.png

              Code for main Window:

              import QtQuick 2.13
              import QtQuick.Window 2.13
              import QtQuick.Controls 2.0
              
              Window {
                  width: 640
                  height: 480
                  visible: true
                  title: qsTr("Hello World")
                  SaveDialog{id: save}
                  onXChanged: {
                      save.open()
                  }
                  Rectangle{
                      width: 200
                      height: 200
                      color: 'red'
                      Text {
                          text: qsTr("Two")
                      }
                  }
              }
              
              

              Code for The Dialog:

              import QtQuick 2.12
              import QtQuick.Layouts 1.12
              import QtQuick.Dialogs 1.2
              import QtQuick.Controls 2.0
              
              Dialog{
                  id: dialog
                  width: 200
                  height: 100
                  title: "One"
              }
              
              
              eyllanescE Offline
              eyllanescE Offline
              eyllanesc
              wrote on last edited by eyllanesc
              #6

              @Abdulrahman Use the accepted signal:

              import QtQuick 2.13
              import QtQuick.Controls 2.0
              import QtQuick.Window 2.13
              
              Window {
                  width: 640
                  height: 480
                  visible: true
                  title: qsTr("Hello World")
                  onXChanged: function() {
                      save.open();
                  }
              
                  SaveDialog {
                      id: save
              
                      onAccepted: function() {
                          rect.visible = true;
                      }
                  }
              
                  Rectangle {
                      id: rect
              
                      width: 200
                      height: 200
                      color: 'red'
                      visible: false
              
                      Text {
                          text: qsTr("Two")
                      }
              
                  }
              
              }
              

              If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

              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