summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-04-28 08:54:11 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-04-28 08:59:44 (GMT)
commit0901f3f8055240d97def42d59e6a76e0b299e985 (patch)
tree3898f7a46fdf25af66c391326d6ac67d9d2e490d /src
parent0f0dbd09f7bf2ef9d69d1e559ace961d9b236d3b (diff)
downloadQt-0901f3f8055240d97def42d59e6a76e0b299e985.zip
Qt-0901f3f8055240d97def42d59e6a76e0b299e985.tar.gz
Qt-0901f3f8055240d97def42d59e6a76e0b299e985.tar.bz2
Fix a crash with a proxy model applied on the QFileDialog.
The problem was located in _q_enterDirectory, this method take a QModelIndex that can be a model index from the treeview/listview (so it comes from the proxy that is applied) and from the side bar where there is always no proxy applied. Previously we were trying to convert from a proxy index to a source index the value that come from the sidebar which is already a source model index. Now, we just check if the model index is coming from the proxy and in that case we convert it otherwise this model index come from the source. Task-number: 252068 Reviewed-by: jasplin Reviewed-by: ogoffart
Diffstat (limited to 'src')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 073c25b..abb13c0 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -2793,7 +2793,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index)
{
Q_Q(QFileDialog);
// My Computer or a directory
- QModelIndex sourceIndex = mapToSource(index);
+ QModelIndex sourceIndex = index.model() == proxyModel ? mapToSource(index) : index;
QString path = sourceIndex.data(QFileSystemModel::FilePathRole).toString();
if (path.isEmpty() || model->isDir(sourceIndex)) {
q->setDirectory(path);