From 6734ee9a6ddb6a3870556514a70d904836258559 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 19 Oct 2018 14:20:33 +0200 Subject: FolderListModel: use header initialization; fix pedantic warnings 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 --- .../folderlistmodel/qquickfolderlistmodel.cpp | 38 ++++++++-------------- .../folderlistmodel/qquickfolderlistmodel.h | 2 +- 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 data; QHash 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 { -- cgit v1.2.3