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. QTabWidget, Signal & Slot
Forum Updated to NodeBB v4.3 + New Features

QTabWidget, Signal & Slot

Scheduled Pinned Locked Moved Unsolved General and Desktop
c++signal & slotqtabwidget
13 Posts 3 Posters 5.6k Views 2 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.
  • TheBadgerT Offline
    TheBadgerT Offline
    TheBadger
    wrote on last edited by
    #4

    Perhaps use a timer to delay the updating:

    void MaFenetre::isChanged(int pos){
        if(pos == 0) {
            QTimer::singleShot(200, this, &MaFenetre::updateMain);
        }
    }
    

    Check out my SpellChecker Plugin for Qt Creator @ https://github.com/CJCombrink/SpellChecker-Plugin

    X 1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #5

      There's some kind of strange loop here.

      Basically, when allTab has its index changed to 0, you set it to 0 again, and then call updateMain. What is the purpose of allTab in MaFenêtre ?

      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
      0
      • TheBadgerT TheBadger

        Perhaps use a timer to delay the updating:

        void MaFenetre::isChanged(int pos){
            if(pos == 0) {
                QTimer::singleShot(200, this, &MaFenetre::updateMain);
            }
        }
        
        X Offline
        X Offline
        Xavier59
        wrote on last edited by
        #6

        @TheBadger said:

        Perhaps use a timer to delay the updating:

        void MaFenetre::isChanged(int pos){
            if(pos == 0) {
                QTimer::singleShot(200, this, &MaFenetre::updateMain);
            }
        }
        

        Thanks a lot, This solution worked fine for me !

        @SGaist said:

        There's some kind of strange loop here.

        Basically, when allTab has its index changed to 0, you set it to 0 again, and then call updateMain. What is the purpose of allTab in MaFenêtre ?

        The fact is that it wasn't changing my tab until updateMain(); finished. As my function take some time to be executed (2-3 seconds) when I was clicking on the index 0, i had a delay of 2-3 seconds before it switched to this tab.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #7

          Should that updating happen only before that tab is shown ?

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

          X 1 Reply Last reply
          0
          • SGaistS SGaist

            Should that updating happen only before that tab is shown ?

            X Offline
            X Offline
            Xavier59
            wrote on last edited by
            #8

            @SGaist said:

            Should that updating happen only before that tab is shown ?

            Kind of. It's useless to update it while the user don't want to see them.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #9

              In that case why not trigger it through the showEvent of your widget ?

              What makes that update take so much time ?

              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
              0
              • X Offline
                X Offline
                Xavier59
                wrote on last edited by
                #10

                I apologize for the delay.
                I'm downloading a picture during the update, that's why it is taking so much time.
                Of course, I could do a QThread, but I try to use them as less as possible to not over thread.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #11

                  Are you downloading it each time ?

                  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
                  0
                  • X Offline
                    X Offline
                    Xavier59
                    wrote on last edited by
                    #12

                    Yes, I want to download it again each time I'm back on my update tab.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #13

                      In that case why not add a spinner or busy indicator and show the widget directly ? It will at least remove the feeling that your application is stuck.

                      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
                      0

                      • Login

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