From 61cefb2f7a7cb16dfa2732e26d2319017039ef62 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 23 Nov 2015 14:47:05 +0100 Subject: De-inline QFileSystemModel::fileInfo() and implement it efficiently De-inline the method, and return the file info that's already being cached by the model. This is ok to do in a minor release, as apps compiled against an older version of Qt will simply continue to use the less efficient implementation. Change-Id: I164c7961a8cf97447638af316512326442767dd8 Task-number: QTBUG-30902 Reviewed-by: Marc Mutz Reviewed-by: Edward Welbourne Reviewed-by: Konstantin Ritt --- src/widgets/dialogs/qfilesystemmodel.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/widgets/dialogs/qfilesystemmodel.h') diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index f749c97bcb..add1a7241a 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -132,7 +132,7 @@ public: inline QString fileName(const QModelIndex &index) const; inline QIcon fileIcon(const QModelIndex &index) const; QFile::Permissions permissions(const QModelIndex &index) const; - inline QFileInfo fileInfo(const QModelIndex &index) const; + QFileInfo fileInfo(const QModelIndex &index) const; bool remove(const QModelIndex &index); protected: @@ -156,8 +156,6 @@ inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const { return aindex.data(Qt::DisplayRole).toString(); } inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const { return qvariant_cast(aindex.data(Qt::DecorationRole)); } -inline QFileInfo QFileSystemModel::fileInfo(const QModelIndex &aindex) const -{ return QFileInfo(filePath(aindex)); } #endif // QT_NO_FILESYSTEMMODEL -- cgit v1.2.3 From e808c5fa6096eb4bc84b6d90c9befa9e805fa680 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 24 Nov 2015 09:21:53 +0100 Subject: Don't use QList Change it to use a QVector instead. Change-Id: Ie1749f326ba1165db48c0eb8763eb738672c7afd Reviewed-by: Marc Mutz --- src/widgets/dialogs/qfilesystemmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/dialogs/qfilesystemmodel.h') diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index add1a7241a..515417f225 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -146,7 +146,7 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_directoryChanged(const QString &directory, const QStringList &list)) Q_PRIVATE_SLOT(d_func(), void _q_performDelayedSort()) - Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QList > &)) + Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QVector > &)) Q_PRIVATE_SLOT(d_func(), void _q_resolvedName(const QString &fileName, const QString &resolvedName)) friend class QFileDialogPrivate; -- cgit v1.2.3