summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-10-19 14:20:33 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2018-10-19 12:35:44 +0000
commit6734ee9a6ddb6a3870556514a70d904836258559 (patch)
treea4b5f7a8e880cd6b6f7aa1dfea81521a3c4d1e86
parent4d8cdc7d69594602246807097b92f72b42f4f6e9 (diff)
FolderListModel: use header initialization; fix pedantic warningsv5.12.0-beta3
That is, initialize variables in the private class where they are defined, and move the padding warning out of that section (now it says the whole class is padded to the alignment boundary, but there's not much we can do about that). Change-Id: I63101b6a837c69265c73b4c6001f1901fcaa8572 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.cpp38
-rw-r--r--src/imports/folderlistmodel/qquickfolderlistmodel.h2
2 files changed, 14 insertions, 26 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
index 3c00a76cc5..affb1e9fe2 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp
@@ -51,17 +51,7 @@ class QQuickFolderListModelPrivate
Q_DECLARE_PUBLIC(QQuickFolderListModel)
public:
- QQuickFolderListModelPrivate(QQuickFolderListModel *q)
- : q_ptr(q),
- sortField(QQuickFolderListModel::Name), sortReversed(false), showFiles(true),
- showDirs(true), showDirsFirst(false), showDotAndDotDot(false), showOnlyReadable(false),
- showHidden(false), caseSensitive(true), sortCaseSensitive(true),
- status(QQuickFolderListModel::Null)
-
- {
- nameFilters << QLatin1String("*");
- }
-
+ QQuickFolderListModelPrivate(QQuickFolderListModel *q) : q_ptr(q) { }
QQuickFolderListModel *q_ptr;
QUrl currentDir;
@@ -69,18 +59,18 @@ public:
FileInfoThread fileInfoThread;
QList<FileProperty> data;
QHash<int, QByteArray> roleNames;
- QQuickFolderListModel::SortField sortField;
- QStringList nameFilters;
- bool sortReversed;
- bool showFiles;
- bool showDirs;
- bool showDirsFirst;
- bool showDotAndDotDot;
- bool showOnlyReadable;
- bool showHidden;
- bool caseSensitive;
- bool sortCaseSensitive;
- QQuickFolderListModel::Status status;
+ QQuickFolderListModel::SortField sortField = QQuickFolderListModel::Name;
+ QStringList nameFilters = { QLatin1String("*") };
+ QQuickFolderListModel::Status status = QQuickFolderListModel::Null;
+ bool sortReversed = false;
+ bool showFiles = true;
+ bool showDirs = true;
+ bool showDirsFirst = false;
+ bool showDotAndDotDot = false;
+ bool showOnlyReadable = false;
+ bool showHidden = false;
+ bool caseSensitive = true;
+ bool sortCaseSensitive = true;
~QQuickFolderListModelPrivate() {}
void init();
@@ -135,8 +125,6 @@ void QQuickFolderListModelPrivate::updateSorting()
case QQuickFolderListModel::Type:
flags |= QDir::Type;
break;
- default:
- break;
}
emit q->layoutAboutToBeChanged();
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.h b/src/imports/folderlistmodel/qquickfolderlistmodel.h
index cc03ff441b..d93e7daf3f 100644
--- a/src/imports/folderlistmodel/qquickfolderlistmodel.h
+++ b/src/imports/folderlistmodel/qquickfolderlistmodel.h
@@ -81,7 +81,7 @@ class QQuickFolderListModel : public QAbstractListModel, public QQmlParserStatus
//![abslistmodel]
public:
- QQuickFolderListModel(QObject *parent = 0);
+ QQuickFolderListModel(QObject *parent = nullptr);
~QQuickFolderListModel();
enum Roles {