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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 4.7.4, 4.8.2
    • Other
    • None

    Description

      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(); }

      Attachments

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

        Activity

          People

            biochimia João Abecasis
            hsattler Hendrik Sattler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes