diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.cpp | 15 | ||||
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index fd49246e9f..52c06dbaba 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -251,6 +251,21 @@ QModelIndex QFileSystemModel::index(int row, int column, const QModelIndex &pare } /*! + \reimp +*/ +QModelIndex QFileSystemModel::sibling(int row, int column, const QModelIndex &idx) const +{ + if (row == idx.row() && column < QFileSystemModelPrivate::NumColumns) { + // cheap sibling operation: just adjust the column: + return createIndex(row, column, idx.internalPointer()); + } else { + // for anything else: call the default implementation + // (this could probably be optimized, too): + return QAbstractItemModel::sibling(row, column, idx); + } +} + +/*! \overload Returns the model item index for the given \a path and \a column. diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index f749c97bcb..cef85a0c8c 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -75,6 +75,7 @@ public: QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; QModelIndex index(const QString &path, int column = 0) const; QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; + QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; |