Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Trying to send 2 signals to different methods when button clicked and start in parallel
Forum Updated to NodeBB v4.3 + New Features

Trying to send 2 signals to different methods when button clicked and start in parallel

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 301 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.
  • J Offline
    J Offline
    john_hobbyist
    wrote on last edited by
    #1

    So, the problem is that I am trying to include a progress bar in my code, like this: https://pythonpyqt.com/pyqt-progressbar/ so when I press a button to my main window as the processing takes place, in parallel a progress bar opeerates. I tried the code from the below links:

    1. https://stackoverflow.com/questions/32285370/python-calling-two-functions-by-clicking-one-button-in-pyqt/32285438
    2. https://stackoverflow.com/questions/24544189/how-to-invoke-two-functions-when-a-button-is-clicked

    when I attach 2 different methods the one above the other, the problem is that the 1st method finishes and then the second method that includes the progress bar starts. As you can understand this concept cannot work. Also I tried to include the 2 methods to one method and trigger that one method when the button is pressed. Again it does not work correctly. I have read in the above links something about thread programming, but I have no idea where to start... Any ideas? Is thread programming the only way ? If yes, where should I start?

    jsulmJ 1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by
      #2

      To update your progress bar, in the first method use a timer.

      1 Reply Last reply
      1
      • J john_hobbyist

        So, the problem is that I am trying to include a progress bar in my code, like this: https://pythonpyqt.com/pyqt-progressbar/ so when I press a button to my main window as the processing takes place, in parallel a progress bar opeerates. I tried the code from the below links:

        1. https://stackoverflow.com/questions/32285370/python-calling-two-functions-by-clicking-one-button-in-pyqt/32285438
        2. https://stackoverflow.com/questions/24544189/how-to-invoke-two-functions-when-a-button-is-clicked

        when I attach 2 different methods the one above the other, the problem is that the 1st method finishes and then the second method that includes the progress bar starts. As you can understand this concept cannot work. Also I tried to include the 2 methods to one method and trigger that one method when the button is pressed. Again it does not work correctly. I have read in the above links something about thread programming, but I have no idea where to start... Any ideas? Is thread programming the only way ? If yes, where should I start?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @john_hobbyist said in Trying to send 2 signals to different methods when button clicked and start in parallel:

        Any ideas?

        https://doc.qt.io/qt-5/thread-basics.html

        "Any ideas? Is thread programming the only way ?" - could be. It is not really clear what you are doing. If you have long lasting task and don't want to block main thread, then yes, threads are the way to go.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2

        • Login

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