summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qsidebar.cpp10
-rw-r--r--src/widgets/dialogs/qsidebar_p.h9
2 files changed, 13 insertions, 6 deletions
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index 713ccb6556..9bb046db61 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -274,7 +274,7 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move)
continue;
insertRows(row, 1);
setUrl(index(row, 0), url, idx);
- watching.append(qMakePair(idx, cleanUrl));
+ watching.append({idx, cleanUrl});
}
}
@@ -326,7 +326,7 @@ void QUrlModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
{
QModelIndex parent = topLeft.parent();
for (int i = 0; i < watching.count(); ++i) {
- QModelIndex index = watching.at(i).first;
+ QModelIndex index = watching.at(i).index;
if (index.model() && topLeft.model()) {
Q_ASSERT(index.model() == topLeft.model());
}
@@ -335,7 +335,7 @@ void QUrlModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
&& index.column() >= topLeft.column()
&& index.column() <= bottomRight.column()
&& index.parent() == parent) {
- changed(watching.at(i).second);
+ changed(watching.at(i).path);
}
}
}
@@ -349,12 +349,12 @@ void QUrlModel::layoutChanged()
const int numPaths = watching.count();
paths.reserve(numPaths);
for (int i = 0; i < numPaths; ++i)
- paths.append(watching.at(i).second);
+ paths.append(watching.at(i).path);
watching.clear();
for (int i = 0; i < numPaths; ++i) {
QString path = paths.at(i);
QModelIndex newIndex = fileSystemModel->index(path);
- watching.append(QPair<QModelIndex, QString>(newIndex, path));
+ watching.append({newIndex, path});
if (newIndex.isValid())
changed(path);
}
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 3e177e7e68..0685e81b2b 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -108,9 +108,16 @@ private:
void changed(const QString &path);
void addIndexToWatch(const QString &path, const QModelIndex &index);
QFileSystemModel *fileSystemModel;
- QVector<QPair<QModelIndex, QString> > watching;
+ struct WatchItem {
+ QModelIndex index;
+ QString path;
+ };
+ friend class QTypeInfo<WatchItem>;
+
+ QVector<WatchItem> watching;
QList<QUrl> invalidUrls;
};
+Q_DECLARE_TYPEINFO(QUrlModel::WatchItem, Q_MOVABLE_TYPE);
class Q_AUTOTEST_EXPORT QSidebar : public QListView
{