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

QComboBox popup collapses after call hide rows in view

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 4.7.4
    • Widgets: Itemviews
    • None
    • Windows 7 (classic theme)

    Description

      Set QListView as QComboBox's view. Add more than maxVisibleItems rows. Use QListView::setRowHidden to hide one row. Popup will show maxVisibleItems - 1 rows despite there are still more than maxVisibleItems rows in model. If you hide maxVisibleItems rows, popup become completely collapsed.

      Code sample:

      	QComboBox comboBox;
      	QListView* view = new QListView;
      
      	comboBox.setView(view);
      
      	for (int row = 0; row < comboBox.maxVisibleItems() * 2; ++row)
      	{
      		view->model()->insertRow(view->model()->rowCount(), QModelIndex());
      		const QModelIndex index = view->model()->index(view->model()->rowCount() - 1, 0, QModelIndex());
      		view->model()->setData(index, QVariant(QString::number(row)), Qt::DisplayRole);
      	}
      
      	for (int row = 0; row < comboBox.maxVisibleItems() - 1; ++row)
      	{
      		// Popup become shorter after each iteration
      		view->setRowHidden(row, true);
      	}

      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)
            username Full Name
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes