Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Show window in parallel

    General and Desktop
    3
    3
    112
    Loading More Posts
    • 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.
    • ivanicy
      ivanicy last edited by

      Hello!!

      I have a function that takes a long time to run in MainWindow. How can I launch a window in parallel for the duration of the process?

      Thank you very much!

      Pl45m4 1 Reply Last reply Reply Quote 0
      • Pl45m4
        Pl45m4 @ivanicy last edited by Pl45m4

        @ivanicy

        Run this function in a new thread.

        • Create worker QObject
        • Let the worker do your "work" (put your function there)
        • Create new QThread and moveToThread your worker.
        • Then you can communicate with signals and slots with your thread / worker and do something else in your MainWindow (show another window or do some other stuff)

        Like here


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply Reply Quote 2
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          Depending on what that function does, QtConcurrent::run might be a simpler alternative.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 1
          • First post
            Last post