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

Qt Model/View setIndexWidget() performance issue

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.0.0
    • Widgets: Itemviews
    • None
    • Windows 7 MVSC 2010

    Description

      I have a QListView that uses a QStandardItem model , to this listView I am adding a QPushButton(test case) using setIndexWidget(). When I am trying to load a large data set to the list it takes time and the application freezes for a while.

      For eg

      for (int i=0; i<500; i++)
      {
      QStandardItem *item = new QStandardItem(QString("Item %1").arg( i));
      model->appendRow(item);

      QModelIndex index = model->indexFromItem(item);
      listView->setIndexWidget(index,new QPushButton("Hello World"));
      }

      The above example takes around 15 sec to display but if i remove setIndexWidget() and just create an instance of QPushButton(test case) it displays the items in no time.

      Why does setIndexWidget() takes long time, Is there any workaround to load the widgets without taking long time.

      Attachments

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

        Activity

          People

            stephen.kelly Stephen Kelly (Unused account) (Inactive)
            soumitra1531 Soumitra Mukherjee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes