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

QFileDialog::setSelectedFiles() : opening QFileDialog with multiple files selected

    XMLWordPrintable

Details

    Description

      Would be useful to have a setter function to suit function:
      QStringList QFileDialog::selectedFiles () const

      Is it possible to add this behavior to existing Qt 4.4.x and later with like following in a QFileDialog subclass:

      setFileMode(QFileDialog::ExistingFiles);
      ...

      QStringList currentList;
      // populate with old values of QFileDialog::selectedFiles();
      ...

      QListView view = findChild<QListView>("listView");
      if (view && view->selectionModel()){
      QItemSelectionModel *sectionModel = view->selectionModel();
      QFileSystemModel model = (QFileSystemModel)view->model();
      sectionModel->clear();
      QModelIndex index;
      foreach(const QString fileName, currentList)

      { index = model->index(fileName); if (index.isValid()) sectionModel->select(index, QItemSelectionModel::SelectCurrent|QItemSelectionModel::Rows); }

      }else

      { qWarning() << "Did not find listview"; }

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            isdale Keith Isdale (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes