Important: Please read the Qt Code of Conduct -

How to change progressBar in qTableWidget

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

  • Lifetime Qt Champion


    You should first explain how you put the bar there.

  • @SGaist Hi code the possible solution is
    QProgressBar l = ui->tableWidget->cellWidget(ui->tableWidget->rowCount()-1,6)->findChild<QProgressBar>();

  • Lifetime Qt Champion

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

  • @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 ))

  • Lifetime Qt Champion

    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.

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

  • Lifetime Qt Champion

    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.

  • Lifetime Qt Champion

    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.

  • @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)

  • Lifetime Qt Champion

    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.

  • @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.

Log in to reply