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

QItemSelectionModel::selectedRows() doesn't respect Qt::ItemIsSelectable

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.3.1
    • Widgets: Itemviews
    • None
    • 288365 289593

    Description

      QItemSelectionModel::selectedRows() doesn't respect Qt::ItemIsSelectable. Consider the following example:

      #include <QtDebug>
      #include <QtGui>

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      QTreeWidget w;
      for(int i=0; i < 10; ++i)
      {
      QTreeWidgetItem *item = new QTreeWidgetItem;
      if(i&1)

      { item->setText(0,"-"); item->setFlags(0); }

      else
      item->setText(0,QString::number);

      w.insertTopLevelItem(i, item);
      }
      w.setSelectionMode(QAbstractItemView::ExtendedSelection);
      w.show();
      a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
      a.exec();
      qDebug() << w.selectionModel()->selectedIndexes().size();
      qDebug() << w.selectionModel()->selectedRows().size();
      return 1;
      }

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes