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

QFileSystemModel::filename() uses wrong role value for call to data() method

XMLWordPrintable

    • 5eba8693b (dev), 7c97e8d2a (6.8), b28cf44e6 (6.7), 1d524f5a2 (tqtc/lts-6.5)

      Currently (even for Qt-5), the code look like that:
      inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const

      { return aindex.data(Qt::DisplayRole).toString(); }

      However, the implementation of the data() method uses a different role:
      case FileNameRole:
      return d->name(index);

      So the filename() method fails whenever the column in aindex is not zero.
      The corrected method should look like:
      inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const

      { return aindex.data(FileNameRole).toString(); }

        For Gerrit Dashboard: QTBUG-27205
        # Subject Branch Project Status CR V

            dfaure_kdab David Faure
            hsattler Hendrik Sattler
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes