diff options
author | Alexis Menard <alexis.menard@trolltech.com> | 2009-04-03 11:49:13 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@trolltech.com> | 2009-04-03 11:53:36 (GMT) |
commit | 10f0b31dd1b3193bf4c068edde5979881c82ece7 (patch) | |
tree | e1953ca88f33e6cfdc78d599b12ba102194f4d62 /src/gui/dialogs/qfiledialog_p.h | |
parent | ed9fe24ecce5a21f93c88c08d2034bf175808fa3 (diff) | |
download | Qt-10f0b31dd1b3193bf4c068edde5979881c82ece7.zip Qt-10f0b31dd1b3193bf4c068edde5979881c82ece7.tar.gz Qt-10f0b31dd1b3193bf4c068edde5979881c82ece7.tar.bz2 |
Fix a crash in QFileDialog with a proxy on it.
The main problem is that enterDirectory received a QModelIndex that can
be a proxy index and not a source index if there is a proxy set on the
QFileDialog. This fix basically discover some other crashes in the
completer. The problem was that we didn't apply the proxy to the
completer too. So we basically messed up source and proxy indexes.
Both have a proxy set now and convert the model indexes if needed.
Task-number:250194
Reviewed-by:jasplin
Diffstat (limited to 'src/gui/dialogs/qfiledialog_p.h')
-rw-r--r-- | src/gui/dialogs/qfiledialog_p.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 8cb2cb0..dc24390 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -91,6 +91,26 @@ class QCompleter; class QHBoxLayout; class Ui_QFileDialog; +#ifndef QT_NO_COMPLETER +/*! + QCompleter that can deal with QFileSystemModel + */ +class QFSCompletor : public QCompleter { +public: + QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0) + { +#ifdef Q_OS_WIN + setCaseSensitivity(Qt::CaseInsensitive); +#endif + } + QString pathFromIndex(const QModelIndex &index) const; + QStringList splitPath(const QString& path) const; + + QAbstractProxyModel *proxyModel; + QFileSystemModel *sourceModel; +}; +#endif // QT_NO_COMPLETER + struct QFileDialogArgs { QFileDialogArgs() : parent(0), mode(QFileDialog::AnyFile) {} @@ -255,7 +275,7 @@ public: // data QStringList watching; QFileSystemModel *model; - QCompleter *completer; + QFSCompletor *completer; QFileDialog::FileMode fileMode; QFileDialog::AcceptMode acceptMode; @@ -434,23 +454,6 @@ inline QString QFileDialogPrivate::rootPath() const { inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return QString(); } #endif -#ifndef QT_NO_COMPLETER -/*! - QCompleter that can deal with QFileSystemModel - */ -class QFSCompletor : public QCompleter { -public: - QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent) - { -#ifdef Q_OS_WIN - setCaseSensitivity(Qt::CaseInsensitive); -#endif - } - QString pathFromIndex(const QModelIndex &index) const; - QStringList splitPath(const QString& path) const; -}; -#endif // QT_NO_COMPLETER - QT_END_NAMESPACE #endif // QT_NO_FILEDIALOG |