Qt Application gets freezed due to read huge data from SQLite database periodically



  • i have issues in showing huge data in QTableView ,data read from sqlite database which is being updated dynamically .. 2k rows in 2s.
    i am using QSQLRelationModel
    let me describe the scenario in detail.

    My Qt application has a view i.e QTableView , each row has following structure:


    QPushButton|QLabel | QLabel | QLabel *


    i have created it using QItemDelegate

    each row isinserted dynamicaly , after sometime gui gets freezed.

    could anyone tell me the way to fix the issue.

    Thanks in advance.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do I understand correctly that you are creating one widget per column for the 4 columns ? If so, it means that you are trying to create more than 8000 widgets in 2 seconds which isn't exactly efficient and performance friendly.

    What is your exact setup ?



  • hi
    I have created a class customDelegate (inherits QItemDelegate) in my Qt applicatrion and i created setEditor() function.But the delegate is not visible in the QTableView , untill i click on the row.
    How to fix the issue?


  • Moderators

    @Sudo007 said:

    How to fix the issue?

    caching, paging, query optimization, etc. ... but this is a rather generic answer to a generic question.



  • @Sudo007 said:

    hi
    I have created a class customDelegate (inherits QItemDelegate) in my Qt applicatrion and i created setEditor() function.But the delegate is not visible in the QTableView , untill i click on the row.
    How to fix the issue?

    How did you implement the paint() in your custom delegate ? As you are adding different widget in each cell, you need to paint a fake widget (QPushButton) using QApplication::style()->drawControl(QStyle::CE_PushButton, &btn,painter); where btn is QStyleOptionButton, then in createEditor() you create an instance of QPushButton.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.