Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-63967

QTreeView selection is laggy with a distant SQL Server

    XMLWordPrintable

Details

    Description

      Hello,

       

      I'm experiencing poor performance with a basic QSqlQueryModel displayed in a QTreeView under SQL Server when the DB is on a distant network.
      The row selection hover effect and the selection are laggy (~5 FPS) and the lag is proportionnal to the network latency.
      This has nothing to do with the number of records retrieved (10 records is enough).

      Since with my sample code, all the data is displayed on the screen, I guess there shouldn't be any network accesses but it seems that it behaves differently.
      It may be related to the SQL driver that does not support "forwardOnly" mode and "QuerySize" feature.
      Can you do something about it ?

      Sample code :

      #include <QApplication>
      #include <QDebug>
      #include <QSqlDatabase>
      #include <QSqlQueryModel>
      #include <QTreeView>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          // init db
          QSqlDatabase BDD = QSqlDatabase::addDatabase("QODBC",nomConnexion);
          BDD.setDatabaseName("DATABASE=XXXXX;SERVER=XXX.XX.XX.XX;DRIVER=SQL Server Native Client 11.0;");
          BDD.setUserName("XXX");
          BDD.setPassword("YYY");
          BDD.open();
      
          QSqlQueryModel *model = new QSqlQueryModel();
          model->setQuery("SELECT TOP 10 ID FROM USER", BDD);
      
          QTreeView *aTreeView = new QTreeView();
          aTreeView->setModel(model);
          aTreeView->setSelectionMode(QTreeView::SelectionMode::ExtendedSelection);
          aTreeView->show();
      
          return a.exec();
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              andysh Andy Shaw
              n.moreaud Nicolas Moreaud
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes