Don't use QList<QPair>
Change it to use a QVector instead. Change-Id: Ie1749f326ba1165db48c0eb8763eb738672c7afd Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
ca14600965
commit
e808c5fa60
@ -287,7 +287,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
|
||||
}
|
||||
for (int i = infoList.count() - 1; i >= 0; --i) {
|
||||
QString driveName = translateDriveName(infoList.at(i));
|
||||
QList<QPair<QString,QFileInfo> > updatedFiles;
|
||||
QVector<QPair<QString,QFileInfo> > updatedFiles;
|
||||
updatedFiles.append(QPair<QString,QFileInfo>(driveName, infoList.at(i)));
|
||||
emit updates(path, updatedFiles);
|
||||
}
|
||||
@ -298,7 +298,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
|
||||
base.start();
|
||||
QFileInfo fileInfo;
|
||||
bool firstTime = true;
|
||||
QList<QPair<QString, QFileInfo> > updatedFiles;
|
||||
QVector<QPair<QString, QFileInfo> > updatedFiles;
|
||||
QStringList filesToCheck = files;
|
||||
|
||||
QString itPath = QDir::fromNativeSeparators(files.isEmpty() ? path : QLatin1String(""));
|
||||
@ -324,7 +324,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
|
||||
emit directoryLoaded(path);
|
||||
}
|
||||
|
||||
void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) {
|
||||
void QFileInfoGatherer::fetch(const QFileInfo &fileInfo, QElapsedTimer &base, bool &firstTime, QVector<QPair<QString, QFileInfo> > &updatedFiles, const QString &path) {
|
||||
updatedFiles.append(QPair<QString, QFileInfo>(fileInfo.fileName(), fileInfo));
|
||||
QElapsedTimer current;
|
||||
current.start();
|
||||
|
@ -149,7 +149,7 @@ class Q_AUTOTEST_EXPORT QFileInfoGatherer : public QThread
|
||||
Q_OBJECT
|
||||
|
||||
Q_SIGNALS:
|
||||
void updates(const QString &directory, const QList<QPair<QString, QFileInfo> > &updates);
|
||||
void updates(const QString &directory, const QVector<QPair<QString, QFileInfo> > &updates);
|
||||
void newListOfFiles(const QString &directory, const QStringList &listOfFiles) const;
|
||||
void nameResolved(const QString &fileName, const QString &resolvedName) const;
|
||||
void directoryLoaded(const QString &path);
|
||||
@ -176,7 +176,7 @@ private:
|
||||
void run() Q_DECL_OVERRIDE;
|
||||
// called by run():
|
||||
void getFileInfos(const QString &path, const QStringList &files);
|
||||
void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QList<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);
|
||||
void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QVector<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);
|
||||
|
||||
private:
|
||||
mutable QMutex mutex;
|
||||
|
@ -1110,7 +1110,7 @@ void QFileSystemModel::sort(int column, Qt::SortOrder order)
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
QModelIndexList oldList = persistentIndexList();
|
||||
QList<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > oldNodes;
|
||||
QVector<QPair<QFileSystemModelPrivate::QFileSystemNode*, int> > oldNodes;
|
||||
const int nodeCount = oldList.count();
|
||||
oldNodes.reserve(nodeCount);
|
||||
for (int i = 0; i < nodeCount; ++i) {
|
||||
@ -1756,7 +1756,7 @@ void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int
|
||||
The thread has received new information about files,
|
||||
update and emit dataChanged if it has actually changed.
|
||||
*/
|
||||
void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &updates)
|
||||
void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &updates)
|
||||
{
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
Q_Q(QFileSystemModel);
|
||||
@ -1875,12 +1875,12 @@ void QFileSystemModelPrivate::_q_resolvedName(const QString &fileName, const QSt
|
||||
void QFileSystemModelPrivate::init()
|
||||
{
|
||||
Q_Q(QFileSystemModel);
|
||||
qRegisterMetaType<QList<QPair<QString,QFileInfo> > >();
|
||||
qRegisterMetaType<QVector<QPair<QString,QFileInfo> > >();
|
||||
#ifndef QT_NO_FILESYSTEMWATCHER
|
||||
q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)),
|
||||
q, SLOT(_q_directoryChanged(QString,QStringList)));
|
||||
q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QList<QPair<QString,QFileInfo> >)),
|
||||
q, SLOT(_q_fileSystemChanged(QString,QList<QPair<QString,QFileInfo> >)));
|
||||
q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QVector<QPair<QString,QFileInfo> >)),
|
||||
q, SLOT(_q_fileSystemChanged(QString,QVector<QPair<QString,QFileInfo> >)));
|
||||
q->connect(&fileInfoGatherer, SIGNAL(nameResolved(QString,QString)),
|
||||
q, SLOT(_q_resolvedName(QString,QString)));
|
||||
q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)),
|
||||
|
@ -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<QPair<QString, QFileInfo> > &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_resolvedName(const QString &fileName, const QString &resolvedName))
|
||||
|
||||
friend class QFileDialogPrivate;
|
||||
|
@ -283,7 +283,7 @@ public:
|
||||
|
||||
void _q_directoryChanged(const QString &directory, const QStringList &list);
|
||||
void _q_performDelayedSort();
|
||||
void _q_fileSystemChanged(const QString &path, const QList<QPair<QString, QFileInfo> > &);
|
||||
void _q_fileSystemChanged(const QString &path, const QVector<QPair<QString, QFileInfo> > &);
|
||||
void _q_resolvedName(const QString &fileName, const QString &resolvedName);
|
||||
|
||||
static int naturalCompare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs);
|
||||
|
Loading…
Reference in New Issue
Block a user