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

QFileDialog::selectedFiles not up to date.

    XMLWordPrintable

Details

    Description

      The selectedFiles function does not contain the actual selected files called from a slot connected to currentChanged.

      #include <QtGui>

      class Dialog : public QFileDialog
      {
      Q_OBJECT
      public:
      Dialog() : QFileDialog()

      { connect(this, SIGNAL(currentChanged(const QString &)), SLOT(theSelectionHasChanged(const QString &))); }

      public slots:
      void theSelectionHasChanged(const QString &path)

      { qDebug() << "Current Selected file: " << path; qDebug() << "Selected Files: " << selectedFiles(); }

      };

      #include "main.moc"

      int main(int argc, char** argv) {
      QApplication app(argc, argv);
      Dialog d;
      d.show();
      return app.exec();
      }

      In the example above, if you select a few files and then ctrl click another file (adding to the existing list) the selectedFiles function will print a list of the files that were already selected but not the most recently selected file.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            mch Jervey Kong
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes