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. How to change progressBar in qTableWidget
QtWS25 Last Chance

How to change progressBar in qTableWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 4.5k Views
  • 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.
  • M Offline
    M Offline
    mark_ua_1999
    wrote on 16 Nov 2017, 18:55 last edited by
    #1

    Hi, how it is possible to reach the progressbar in qtTableWidget to change it value,
    hope your ideas will help to resolve the problem
    0_1510858480741_Capture888.PNG

    J 1 Reply Last reply 17 Nov 2017, 00:44
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 16 Nov 2017, 19:47 last edited by
      #2

      Hi,

      You should first explain how you put the bar there.

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

      M 1 Reply Last reply 16 Nov 2017, 20:11
      1
      • S SGaist
        16 Nov 2017, 19:47

        Hi,

        You should first explain how you put the bar there.

        M Offline
        M Offline
        mark_ua_1999
        wrote on 16 Nov 2017, 20:11 last edited by mark_ua_1999
        #3

        @SGaist Hi code the possible solution is
        QProgressBar l = ui->tableWidget->cellWidget(ui->tableWidget->rowCount()-1,6)->findChild<QProgressBar>();
        l->setMinimum(0);
        l->setMaximum(train_.passangers.size());
        l->setValue(0);

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 16 Nov 2017, 20:25 last edited by
          #4

          You might want to consider implementing a QStyledItemDelegate that fills the cell according too the number of passengers.

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

          M 1 Reply Last reply 16 Nov 2017, 20:35
          0
          • S SGaist
            16 Nov 2017, 20:25

            You might want to consider implementing a QStyledItemDelegate that fills the cell according too the number of passengers.

            M Offline
            M Offline
            mark_ua_1999
            wrote on 16 Nov 2017, 20:35 last edited by
            #5

            @SGaist Ok do you have any ideas about it (it doesnt crash programm simply irrited the user (you must wait 30 - 40 seconds, so I make the progressbars(but they stoped while not responding) and afterward all works good)0_1510864435588_Capture1011.PNG ))

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 16 Nov 2017, 20:38 last edited by
              #6

              No I don't because I don't know what your application does.

              You could be reading and writing data uselessly, you could be trying to access slow devices, you could be doing something wrong in another part of your application, you could be calling some wait function somewhere, your users my be using your application on overloaded machines. Performance wise, having many cell widgets wont help at all.

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

              M 1 Reply Last reply 16 Nov 2017, 20:49
              2
              • S SGaist
                16 Nov 2017, 20:38

                No I don't because I don't know what your application does.

                You could be reading and writing data uselessly, you could be trying to access slow devices, you could be doing something wrong in another part of your application, you could be calling some wait function somewhere, your users my be using your application on overloaded machines. Performance wise, having many cell widgets wont help at all.

                M Offline
                M Offline
                mark_ua_1999
                wrote on 16 Nov 2017, 20:49 last edited by
                #7

                @SGaist code CreateTrain where I work with data bases while inserting get the problem sample of table where insert0_1510865325720_Capture.PNG

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 16 Nov 2017, 20:54 last edited by
                  #8

                  Like I already wrote, there's no way to guess what's taking time from images while not knowing what else is currently going on within your application.

                  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
                  1
                  • M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 16 Nov 2017, 21:22 last edited by mrjj
                    #9

                    Hi
                    just as a note
                    why are you using Sleep(3); ? in your code?
                    That will slow it down.

                    30-40 seconds seems very long.
                    How many rows do you have ?
                    Must be many or you must have some sort of loop in loop.

                    To help find out what is slow you can use timing

                    using namespace std::chrono;
                    
                        high_resolution_clock::time_point t1 = high_resolution_clock::now(); // put in top of function
                    ... do stuff here...
                        high_resolution_clock::time_point t2 = high_resolution_clock::now(); // put last in function
                    
                        auto duration = duration_cast<microseconds>( t2 - t1 ).count(); // also last
                       std::cout <<"spot 1:" <<  duration;
                    

                    That might help find out where all the time goes.
                    Sadly we cant just guess it as nothing springs to mind from the code shown.

                    Normally sqlite is pretty fast and both reading and writing should not take that long unless you
                    have massive amount of train data.

                    how long (elements) are the vector<cities> &s ?
                    you do seem to loop it for each row.

                    M 1 Reply Last reply 16 Nov 2017, 21:52
                    1
                    • M mrjj
                      16 Nov 2017, 21:22

                      Hi
                      just as a note
                      why are you using Sleep(3); ? in your code?
                      That will slow it down.

                      30-40 seconds seems very long.
                      How many rows do you have ?
                      Must be many or you must have some sort of loop in loop.

                      To help find out what is slow you can use timing

                      using namespace std::chrono;
                      
                          high_resolution_clock::time_point t1 = high_resolution_clock::now(); // put in top of function
                      ... do stuff here...
                          high_resolution_clock::time_point t2 = high_resolution_clock::now(); // put last in function
                      
                          auto duration = duration_cast<microseconds>( t2 - t1 ).count(); // also last
                         std::cout <<"spot 1:" <<  duration;
                      

                      That might help find out where all the time goes.
                      Sadly we cant just guess it as nothing springs to mind from the code shown.

                      Normally sqlite is pretty fast and both reading and writing should not take that long unless you
                      have massive amount of train data.

                      how long (elements) are the vector<cities> &s ?
                      you do seem to loop it for each row.

                      M Offline
                      M Offline
                      mark_ua_1999
                      wrote on 16 Nov 2017, 21:52 last edited by
                      #10

                      @mrjj I have discovered that( Not responding ) is created when i click the screen while loading (do you have any ideas how could I make my mouse cursor loading in program window to not allow any click), but I have discovered also that if left the program for some time and want to add any information afterward it also makes Not responding to appear)

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 16 Nov 2017, 21:55 last edited by
                        #11

                        If you don't want your user to click anything, show a modal dialog explaining what is going on with maybe an infinite progress bar.

                        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
                        • M mark_ua_1999
                          16 Nov 2017, 18:55

                          Hi, how it is possible to reach the progressbar in qtTableWidget to change it value,
                          hope your ideas will help to resolve the problem
                          0_1510858480741_Capture888.PNG

                          J Offline
                          J Offline
                          joeQ
                          wrote on 17 Nov 2017, 00:44 last edited by
                          #12

                          @mark_ua_1999 hi,friend.welcome.

                          I think the example Torrent download like your application's UI. It also has the progressBar in table. so you can reference it.

                          Just do it!

                          1 Reply Last reply
                          2

                          8/12

                          16 Nov 2017, 20:54

                          • Login

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