diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-01-29 12:13:47 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-07-18 13:32:31 +0000 |
commit | 648a496e5e64ccdefe5383238fc7c4b84d0159a8 (patch) | |
tree | bc539f2305d5b5d461e6db26d67da5ac8b8d782b /src/widgets/dialogs/qfilesystemmodel_p.h | |
parent | ce7fb157f0b8f74025e6927e7b61b1d79de0581c (diff) |
QFileSystemModel: avoid sibling() calls
...by allowing to pass the column to the Private::index() overloads.
Because Private::index() always returns an index in column 0,
callers that needed a different column used QModelIndex::sibling()
to adjust the column of the returned index. But that calls
QAIM::sibling(), which calls both QFSM::index() and ::parent().
Simply allowing to pass the column number instead of hard-coding
0 avoids that heavy detour.
Change-Id: I8895b3d102d576ba291333cf61075b7263f96b9d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/widgets/dialogs/qfilesystemmodel_p.h')
-rw-r--r-- | src/widgets/dialogs/qfilesystemmodel_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index 9e9e894e3a..57fb457071 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -222,8 +222,8 @@ public: } QFileSystemNode *node(const QModelIndex &index) const; QFileSystemNode *node(const QString &path, bool fetch = true) const; - inline QModelIndex index(const QString &path) { return index(node(path)); } - QModelIndex index(const QFileSystemNode *node) const; + inline QModelIndex index(const QString &path, int column = 0) { return index(node(path), column); } + QModelIndex index(const QFileSystemNode *node, int column = 0) const; bool filtersAcceptsNode(const QFileSystemNode *node) const; bool passNameFilters(const QFileSystemNode *node) const; void removeNode(QFileSystemNode *parentNode, const QString &name); |