diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-28 08:54:11 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-28 08:59:44 (GMT) |
commit | 0901f3f8055240d97def42d59e6a76e0b299e985 (patch) | |
tree | 3898f7a46fdf25af66c391326d6ac67d9d2e490d /tests | |
parent | 0f0dbd09f7bf2ef9d69d1e559ace961d9b236d3b (diff) | |
download | Qt-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 'tests')
-rw-r--r-- | tests/auto/qfiledialog/tst_qfiledialog.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 13b13d6..689f73d 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -1602,6 +1602,19 @@ void tst_QFiledialog::task227304_proxyOnFileDialog() QTest::keyClick(list, Qt::Key_Return); QTest::qWait(200); + dialog->close(); + fd.close(); + + QNonNativeFileDialog fd2(0, "I should not crash with a proxy", QDir::tempPath(), 0); + QSortFilterProxyModel *pm = new QSortFilterProxyModel; + fd2.setProxyModel(pm); + fd2.show(); + QSidebar *sidebar = qFindChild<QSidebar*>(&fd2, "sidebar"); + sidebar->setFocus(); + sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath())); + QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center()); + QTest::qWait(250); + //We shouldn't crash } void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior() |