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. application is Not responding
Forum Updated to NodeBB v4.3 + New Features

application is Not responding

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 4 Posters 1.1k 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.
  • G Gokul2002

    I tried with a thread but it didn't solve

    def thread(self):
    t1=Thread(target=self.connect)
    t1.start()

    self. connect is the function that run for 30 sec to 1 min

    thread function will connect to the button press

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

    @Gokul2002 t1 is a local variable inside def thread(self) - think about its lifetime.

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

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gokul2002
      wrote on last edited by Gokul2002
      #5

      One more thing I miss to add is the main window UI is in one file and connect is in another file then how to link with the thread

      jsulmJ 1 Reply Last reply
      0
      • G Gokul2002

        One more thing I miss to add is the main window UI is in one file and connect is in another file then how to link with the thread

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

        @Gokul2002 said in application is Not responding:

        main window UI is in one file and connect is in another file then how to link with the thread

        I don't understand the problem.
        And you also did not respond to my previous comment...

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

        G 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Gokul2002 said in application is Not responding:

          main window UI is in one file and connect is in another file then how to link with the thread

          I don't understand the problem.
          And you also did not respond to my previous comment...

          G Offline
          G Offline
          Gokul2002
          wrote on last edited by
          #7

          @jsulm Sorry for that I am in a meeting so I didn't respond
          give 10mins I will explain my problem first.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gokul2002
            wrote on last edited by
            #8

            I have two files one is the main UI file and another is a UI file.
            This main UI and other UI files are linked.

            In the main UI if he pressed edit the the UI will go to the Another function and the UI is updated. but in that UI there is one function called connect it will take 30sec to 1min to complete the task in the mean time if we shift to another application and come back to the application it is showing the not responding unit that function is completed but once the function execution is completed the UI is updating with out any issue

            jsulmJ 1 Reply Last reply
            0
            • G Gokul2002

              I have two files one is the main UI file and another is a UI file.
              This main UI and other UI files are linked.

              In the main UI if he pressed edit the the UI will go to the Another function and the UI is updated. but in that UI there is one function called connect it will take 30sec to 1min to complete the task in the mean time if we shift to another application and come back to the application it is showing the not responding unit that function is completed but once the function execution is completed the UI is updating with out any issue

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

              @Gokul2002 Nothing what you wrote is related to what I wrote: "t1 is a local variable inside def thread(self) - think about its lifetime."

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

              G 1 Reply Last reply
              0
              • jsulmJ jsulm

                @Gokul2002 Nothing what you wrote is related to what I wrote: "t1 is a local variable inside def thread(self) - think about its lifetime."

                G Offline
                G Offline
                Gokul2002
                wrote on last edited by
                #10

                @jsulm I didn't understand what you suppose to say.

                jsulmJ 1 Reply Last reply
                0
                • G Gokul2002

                  @jsulm I didn't understand what you suppose to say.

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

                  @Gokul2002 What do you think how long t1 lives/exists bellow? Think about its scope.

                  def thread(self):
                      t1=Thread(target=self.connect)
                      t1.start()
                  

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

                  G 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Gokul2002 What do you think how long t1 lives/exists bellow? Think about its scope.

                    def thread(self):
                        t1=Thread(target=self.connect)
                        t1.start()
                    
                    G Offline
                    G Offline
                    Gokul2002
                    wrote on last edited by
                    #12

                    @jsulm It will be there until the function completed like connect is complete

                    jsulmJ JonBJ 2 Replies Last reply
                    0
                    • G Gokul2002

                      @jsulm It will be there until the function completed like connect is complete

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

                      @Gokul2002 And this is your problem: the Thread instance will be destroyed while the thread is still running (start() is asynchronous, right?).

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

                      1 Reply Last reply
                      0
                      • G Gokul2002

                        @jsulm It will be there until the function completed like connect is complete

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #14

                        @Gokul2002
                        In Python your Thread will be destroyed immediately after the t1.start(), when it exits thread().

                        Additionally, why are you trying to do a connect() in a thread? I can understand a slot needing to run in a thread, but not a connect() statement, that should complete immediately.

                        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