modernize: Use braced-init list when returning types
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 9 Sep 2018 21:20:09 +0000 (23:20 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 18 Nov 2018 10:06:43 +0000 (11:06 +0100)
25 files changed:
src/client/client.cpp
src/client/coreaccountmodel.cpp
src/client/irclistmodel.cpp
src/client/irclistmodel.h
src/client/messagemodel.h
src/client/networkmodel.cpp
src/client/treemodel.cpp
src/core/ldapauthenticator.cpp
src/core/postgresqlstorage.cpp
src/core/sqlitestorage.cpp
src/qtui/chatline.h
src/qtui/chatview.cpp
src/qtui/nicklistwidget.cpp
src/qtui/settingspages/aliasesmodel.cpp
src/qtui/settingspages/aliasesmodel.h
src/qtui/settingspages/ignorelistmodel.cpp
src/qtui/settingspages/ignorelistmodel.h
src/qtui/settingspages/shortcutsmodel.cpp
src/qtui/verticaldock.cpp
src/qtui/verticaldock.h
src/uisupport/bufferview.cpp
src/uisupport/flatproxymodel.cpp
src/uisupport/networkmodelcontroller.cpp
src/uisupport/qssparser.cpp
src/uisupport/resizingstackedwidget.cpp

index f6e8d24..2c1898d 100644 (file)
@@ -603,7 +603,7 @@ MsgId Client::markerLine(BufferId id)
 {
     if (id.isValid() && networkModel())
         return networkModel()->markerLineMsgId(id);
 {
     if (id.isValid() && networkModel())
         return networkModel()->markerLineMsgId(id);
-    return MsgId();
+    return {};
 }
 
 
 }
 
 
index f7c7724..04ee15f 100644 (file)
@@ -250,7 +250,7 @@ QModelIndex CoreAccountModel::accountIndex(AccountId accId) const
         if (_accounts.at(i).accountId() == accId)
             return index(i, 0);
     }
         if (_accounts.at(i).accountId() == accId)
             return index(i, 0);
     }
-    return QModelIndex();
+    return {};
 }
 
 
 }
 
 
index 32b39ec..91ea7ec 100644 (file)
@@ -77,7 +77,7 @@ QModelIndex IrcListModel::index(int row, int column, const QModelIndex &parent)
 {
     Q_UNUSED(parent);
     if (row >= rowCount() || column >= columnCount())
 {
     Q_UNUSED(parent);
     if (row >= rowCount() || column >= columnCount())
-        return QModelIndex();
+        return {};
 
     return createIndex(row, column);
 }
 
     return createIndex(row, column);
 }
index 8700d1c..76227bc 100644 (file)
@@ -40,7 +40,7 @@ public:
 
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
 
 
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
 
-    inline QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
+    inline QModelIndex parent(const QModelIndex &) const override { return {}; }
 
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override { Q_UNUSED(parent) return _channelList.count(); }
     inline int columnCount(const QModelIndex &parent = QModelIndex()) const override { Q_UNUSED(parent) return 3; }
 
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override { Q_UNUSED(parent) return _channelList.count(); }
     inline int columnCount(const QModelIndex &parent = QModelIndex()) const override { Q_UNUSED(parent) return 3; }
index f27379c..6377282 100644 (file)
@@ -60,7 +60,7 @@ public:
     MessageModel(QObject *parent);
 
     inline QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
     MessageModel(QObject *parent);
 
     inline QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
-    inline QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
+    inline QModelIndex parent(const QModelIndex &) const override { return {}; }
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override { return parent.isValid() ? 0 : messageCount(); }
     inline int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override { return 3; }
 
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override { return parent.isValid() ? 0 : messageCount(); }
     inline int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override { return 3; }
 
@@ -126,7 +126,7 @@ private:
 QModelIndex MessageModel::index(int row, int column, const QModelIndex &parent) const
 {
     if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))
 QModelIndex MessageModel::index(int row, int column, const QModelIndex &parent) const
 {
     if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))
-        return QModelIndex();
+        return {};
 
     return createIndex(row, column);
 }
 
     return createIndex(row, column);
 }
index e4e2e79..86a0746 100644 (file)
@@ -1334,7 +1334,7 @@ QModelIndex NetworkModel::networkIndex(NetworkId networkId)
 {
     int netRow = networkRow(networkId);
     if (netRow == -1)
 {
     int netRow = networkRow(networkId);
     if (netRow == -1)
-        return QModelIndex();
+        return {};
     else
         return indexByItem(qobject_cast<NetworkItem *>(rootItem->child(netRow)));
 }
     else
         return indexByItem(qobject_cast<NetworkItem *>(rootItem->child(netRow)));
 }
@@ -1374,7 +1374,7 @@ void NetworkModel::networkRemoved(const NetworkId &networkId)
 QModelIndex NetworkModel::bufferIndex(BufferId bufferId)
 {
     if (!_bufferItemCache.contains(bufferId))
 QModelIndex NetworkModel::bufferIndex(BufferId bufferId)
 {
     if (!_bufferItemCache.contains(bufferId))
-        return QModelIndex();
+        return {};
 
     return indexByItem(_bufferItemCache[bufferId]);
 }
 
     return indexByItem(_bufferItemCache[bufferId]);
 }
@@ -1485,7 +1485,7 @@ void NetworkModel::removeBuffer(BufferId bufferId)
 MsgId NetworkModel::lastSeenMsgId(BufferId bufferId) const
 {
     if (!_bufferItemCache.contains(bufferId))
 MsgId NetworkModel::lastSeenMsgId(BufferId bufferId) const
 {
     if (!_bufferItemCache.contains(bufferId))
-        return MsgId();
+        return {};
 
     return _bufferItemCache[bufferId]->lastSeenMsgId();
 }
 
     return _bufferItemCache[bufferId]->lastSeenMsgId();
 }
@@ -1494,7 +1494,7 @@ MsgId NetworkModel::lastSeenMsgId(BufferId bufferId) const
 MsgId NetworkModel::markerLineMsgId(BufferId bufferId) const
 {
     if (!_bufferItemCache.contains(bufferId))
 MsgId NetworkModel::markerLineMsgId(BufferId bufferId) const
 {
     if (!_bufferItemCache.contains(bufferId))
-        return MsgId();
+        return {};
 
     return _bufferItemCache[bufferId]->markerLineMsgId();
 }
 
     return _bufferItemCache[bufferId]->markerLineMsgId();
 }
@@ -1507,7 +1507,7 @@ MsgId NetworkModel::lastSeenMsgId(const BufferId &bufferId)
     if (!bufferItem) {
         qDebug() << "NetworkModel::lastSeenMsgId(): buffer is unknown:" << bufferId;
         Client::purgeKnownBufferIds();
     if (!bufferItem) {
         qDebug() << "NetworkModel::lastSeenMsgId(): buffer is unknown:" << bufferId;
         Client::purgeKnownBufferIds();
-        return MsgId();
+        return {};
     }
     return bufferItem->lastSeenMsgId();
 }
     }
     return bufferItem->lastSeenMsgId();
 }
@@ -1688,13 +1688,13 @@ BufferInfo NetworkModel::bufferInfo(BufferId bufferId) const
 NetworkId NetworkModel::networkId(BufferId bufferId) const
 {
     if (!_bufferItemCache.contains(bufferId))
 NetworkId NetworkModel::networkId(BufferId bufferId) const
 {
     if (!_bufferItemCache.contains(bufferId))
-        return NetworkId();
+        return {};
 
     auto *netItem = qobject_cast<NetworkItem *>(_bufferItemCache[bufferId]->parent());
     if (netItem)
         return netItem->networkId();
     else
 
     auto *netItem = qobject_cast<NetworkItem *>(_bufferItemCache[bufferId]->parent());
     if (netItem)
         return netItem->networkId();
     else
-        return NetworkId();
+        return {};
 }
 
 
 }
 
 
@@ -1715,14 +1715,14 @@ BufferId NetworkModel::bufferId(NetworkId networkId, const QString &bufferName,
 {
     const NetworkItem *netItem = findNetworkItem(networkId);
     if (!netItem)
 {
     const NetworkItem *netItem = findNetworkItem(networkId);
     if (!netItem)
-        return BufferId();
+        return {};
 
     for (int i = 0; i < netItem->childCount(); i++) {
         auto *bufferItem = qobject_cast<BufferItem *>(netItem->child(i));
         if (bufferItem && !bufferItem->bufferName().compare(bufferName, cs))
             return bufferItem->bufferId();
     }
 
     for (int i = 0; i < netItem->childCount(); i++) {
         auto *bufferItem = qobject_cast<BufferItem *>(netItem->child(i));
         if (bufferItem && !bufferItem->bufferName().compare(bufferName, cs))
             return bufferItem->bufferId();
     }
-    return BufferId();
+    return {};
 }
 
 
 }
 
 
index 486ed6c..314ec7f 100644 (file)
@@ -352,7 +352,7 @@ AbstractTreeItem *TreeModel::root() const
 QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
 {
     if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))
 QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
 {
     if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))
-        return QModelIndex();
+        return {};
 
     AbstractTreeItem *parentItem;
 
 
     AbstractTreeItem *parentItem;
 
@@ -366,7 +366,7 @@ QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) con
     if (childItem)
         return createIndex(row, column, childItem);
     else
     if (childItem)
         return createIndex(row, column, childItem);
     else
-        return QModelIndex();
+        return {};
 }
 
 
 }
 
 
@@ -374,11 +374,11 @@ QModelIndex TreeModel::indexByItem(AbstractTreeItem *item) const
 {
     if (item == nullptr) {
         qWarning() << "TreeModel::indexByItem(AbstractTreeItem *item) received NULL-Pointer";
 {
     if (item == nullptr) {
         qWarning() << "TreeModel::indexByItem(AbstractTreeItem *item) received NULL-Pointer";
-        return QModelIndex();
+        return {};
     }
 
     if (item == rootItem)
     }
 
     if (item == rootItem)
-        return QModelIndex();
+        return {};
     else
         return createIndex(item->row(), 0, item);
 }
     else
         return createIndex(item->row(), 0, item);
 }
@@ -389,7 +389,7 @@ QModelIndex TreeModel::parent(const QModelIndex &index) const
     if (!index.isValid()) {
         // ModelTest does this
         // qWarning() << "TreeModel::parent(): has been asked for the rootItems Parent!";
     if (!index.isValid()) {
         // ModelTest does this
         // qWarning() << "TreeModel::parent(): has been asked for the rootItems Parent!";
-        return QModelIndex();
+        return {};
     }
 
     auto *childItem = static_cast<AbstractTreeItem *>(index.internalPointer());
     }
 
     auto *childItem = static_cast<AbstractTreeItem *>(index.internalPointer());
@@ -397,7 +397,7 @@ QModelIndex TreeModel::parent(const QModelIndex &index) const
 
     Q_ASSERT(parentItem);
     if (parentItem == rootItem)
 
     Q_ASSERT(parentItem);
     if (parentItem == rootItem)
-        return QModelIndex();
+        return {};
 
     return createIndex(parentItem->row(), 0, parentItem);
 }
 
     return createIndex(parentItem->row(), 0, parentItem);
 }
index 76db681..7448396 100644 (file)
@@ -131,7 +131,7 @@ UserId LdapAuthenticator::validateUser(const QString &username, const QString &p
 {
     bool result = ldapAuth(username, password);
     if (!result) {
 {
     bool result = ldapAuth(username, password);
     if (!result) {
-        return UserId();
+        return {};
     }
 
     // LDAP is case-insensitive, thus we will lowercase the username, in spite of
     }
 
     // LDAP is case-insensitive, thus we will lowercase the username, in spite of
index c414b87..391e2ac 100644 (file)
@@ -494,7 +494,7 @@ IdentityId PostgreSqlStorage::createIdentity(UserId user, CoreIdentity &identity
     safeExec(query);
     if (!watchQuery(query)) {
         db.rollback();
     safeExec(query);
     if (!watchQuery(query)) {
         db.rollback();
-        return IdentityId();
+        return {};
     }
 
     query.first();
     }
 
     query.first();
@@ -503,7 +503,7 @@ IdentityId PostgreSqlStorage::createIdentity(UserId user, CoreIdentity &identity
 
     if (!identityId.isValid()) {
         db.rollback();
 
     if (!identityId.isValid()) {
         db.rollback();
-        return IdentityId();
+        return {};
     }
 
     QSqlQuery insertNickQuery(db);
     }
 
     QSqlQuery insertNickQuery(db);
@@ -514,14 +514,14 @@ IdentityId PostgreSqlStorage::createIdentity(UserId user, CoreIdentity &identity
         safeExec(insertNickQuery);
         if (!watchQuery(insertNickQuery)) {
             db.rollback();
         safeExec(insertNickQuery);
         if (!watchQuery(insertNickQuery)) {
             db.rollback();
-            return IdentityId();
+            return {};
         }
     }
 
     if (!db.commit()) {
         qWarning() << "PostgreSqlStorage::createIdentity(): committing data failed!";
         qWarning() << " -" << qPrintable(db.lastError().text());
         }
     }
 
     if (!db.commit()) {
         qWarning() << "PostgreSqlStorage::createIdentity(): committing data failed!";
         qWarning() << " -" << qPrintable(db.lastError().text());
-        return IdentityId();
+        return {};
     }
     return identityId;
 }
     }
     return identityId;
 }
@@ -715,7 +715,7 @@ NetworkId PostgreSqlStorage::createNetwork(UserId user, const NetworkInfo &info)
     safeExec(query);
     if (!watchQuery(query)) {
         db.rollback();
     safeExec(query);
     if (!watchQuery(query)) {
         db.rollback();
-        return NetworkId();
+        return {};
     }
 
     query.first();
     }
 
     query.first();
@@ -723,7 +723,7 @@ NetworkId PostgreSqlStorage::createNetwork(UserId user, const NetworkInfo &info)
 
     if (!networkId.isValid()) {
         db.rollback();
 
     if (!networkId.isValid()) {
         db.rollback();
-        return NetworkId();
+        return {};
     }
 
     QSqlQuery insertServersQuery(db);
     }
 
     QSqlQuery insertServersQuery(db);
@@ -735,14 +735,14 @@ NetworkId PostgreSqlStorage::createNetwork(UserId user, const NetworkInfo &info)
         safeExec(insertServersQuery);
         if (!watchQuery(insertServersQuery)) {
             db.rollback();
         safeExec(insertServersQuery);
         if (!watchQuery(insertServersQuery)) {
             db.rollback();
-            return NetworkId();
+            return {};
         }
     }
 
     if (!db.commit()) {
         qWarning() << "PostgreSqlStorage::createNetwork(): committing data failed!";
         qWarning() << " -" << qPrintable(db.lastError().text());
         }
     }
 
     if (!db.commit()) {
         qWarning() << "PostgreSqlStorage::createNetwork(): committing data failed!";
         qWarning() << " -" << qPrintable(db.lastError().text());
-        return NetworkId();
+        return {};
     }
     return networkId;
 }
     }
     return networkId;
 }
@@ -1108,7 +1108,7 @@ BufferInfo PostgreSqlStorage::bufferInfo(UserId user, const NetworkId &networkId
     if (!beginTransaction(db)) {
         qWarning() << "PostgreSqlStorage::bufferInfo(): cannot start read only transaction!";
         qWarning() << " -" << qPrintable(db.lastError().text());
     if (!beginTransaction(db)) {
         qWarning() << "PostgreSqlStorage::bufferInfo(): cannot start read only transaction!";
         qWarning() << " -" << qPrintable(db.lastError().text());
-        return BufferInfo();
+        return {};
     }
 
     QSqlQuery query(db);
     }
 
     QSqlQuery query(db);
@@ -1136,7 +1136,7 @@ BufferInfo PostgreSqlStorage::bufferInfo(UserId user, const NetworkId &networkId
 
     if (!create) {
         db.rollback();
 
     if (!create) {
         db.rollback();
-        return BufferInfo();
+        return {};
     }
 
     QSqlQuery createQuery(db);
     }
 
     QSqlQuery createQuery(db);
@@ -1172,10 +1172,10 @@ BufferInfo PostgreSqlStorage::getBufferInfo(UserId user, const BufferId &bufferI
     query.bindValue(":bufferid", bufferId.toInt());
     safeExec(query);
     if (!watchQuery(query))
     query.bindValue(":bufferid", bufferId.toInt());
     safeExec(query);
     if (!watchQuery(query))
-        return BufferInfo();
+        return {};
 
     if (!query.first())
 
     if (!query.first())
-        return BufferInfo();
+        return {};
 
     BufferInfo bufferInfo(query.value(0).toInt(), query.value(1).toInt(), (BufferInfo::Type)query.value(2).toInt(), 0, query.value(4).toString());
     Q_ASSERT(!query.next());
 
     BufferInfo bufferInfo(query.value(0).toInt(), query.value(1).toInt(), (BufferInfo::Type)query.value(2).toInt(), 0, query.value(4).toString());
     Q_ASSERT(!query.next());
index b39c187..ad5b7f2 100644 (file)
@@ -687,7 +687,7 @@ NetworkId SqliteStorage::createNetwork(UserId user, const NetworkInfo &info)
     }
     if (error) {
         unlock();
     }
     if (error) {
         unlock();
-        return NetworkId();
+        return {};
     }
 
     {
     }
 
     {
@@ -709,7 +709,7 @@ NetworkId SqliteStorage::createNetwork(UserId user, const NetworkInfo &info)
     }
     unlock();
     if (error)
     }
     unlock();
     if (error)
-        return NetworkId();
+        return {};
     else
         return networkId;
 }
     else
         return networkId;
 }
index 1fdedd5..e5ee5f7 100644 (file)
@@ -38,7 +38,7 @@ public:
 
     ~ChatLine() override;
 
 
     ~ChatLine() override;
 
-    inline QRectF boundingRect() const override { return QRectF(0, 0, _width, _height); }
+    inline QRectF boundingRect() const override { return {0, 0, _width, _height}; }
 
     inline QModelIndex index() const { return model()->index(row(), 0); }
     inline MsgId msgId() const { return index().data(MessageModel::MsgIdRole).value<MsgId>(); }
 
     inline QModelIndex index() const { return model()->index(row(), 0); }
     inline MsgId msgId() const { return index().data(MessageModel::MsgIdRole).value<MsgId>(); }
index 7b60ba8..007d8bb 100644 (file)
@@ -262,11 +262,11 @@ void ChatView::verticalScrollbarChanged(int newPos)
 MsgId ChatView::lastMsgId() const
 {
     if (!scene())
 MsgId ChatView::lastMsgId() const
 {
     if (!scene())
-        return MsgId();
+        return {};
 
     QAbstractItemModel *model = scene()->model();
     if (!model || model->rowCount() == 0)
 
     QAbstractItemModel *model = scene()->model();
     if (!model || model->rowCount() == 0)
-        return MsgId();
+        return {};
 
     return model->index(model->rowCount() - 1, 0).data(MessageModel::MsgIdRole).value<MsgId>();
 }
 
     return model->index(model->rowCount() - 1, 0).data(MessageModel::MsgIdRole).value<MsgId>();
 }
@@ -279,7 +279,7 @@ MsgId ChatView::lastVisibleMsgId() const
     if (line)
         return line->msgId();
 
     if (line)
         return line->msgId();
 
-    return MsgId();
+    return {};
 }
 
 
 }
 
 
index d2b8fd5..a47e509 100644 (file)
@@ -215,7 +215,7 @@ QSize NickListWidget::sizeHint() const
 {
     QWidget *currentWidget = ui.stackedWidget->currentWidget();
     if (!currentWidget || currentWidget == ui.emptyPage)
 {
     QWidget *currentWidget = ui.stackedWidget->currentWidget();
     if (!currentWidget || currentWidget == ui.emptyPage)
-        return QSize(100, height());
+        return {100, height()};
     else
         return currentWidget->sizeHint();
 }
     else
         return currentWidget->sizeHint();
 }
index 39f2877..cf868f0 100644 (file)
@@ -255,7 +255,7 @@ QModelIndex AliasesModel::index(int row, int column, const QModelIndex &parent)
 {
     Q_UNUSED(parent);
     if (row >= rowCount() || column >= columnCount())
 {
     Q_UNUSED(parent);
     if (row >= rowCount() || column >= columnCount())
-        return QModelIndex();
+        return {};
 
     return createIndex(row, column);
 }
 
     return createIndex(row, column);
 }
index 94cf10e..dc6b08f 100644 (file)
@@ -42,7 +42,7 @@ public:
 
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
 
 
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
 
-    inline QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
+    inline QModelIndex parent(const QModelIndex &) const override { return {}; }
 
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override;
     inline int columnCount(const QModelIndex &parent = QModelIndex()) const override;
 
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override;
     inline int columnCount(const QModelIndex &parent = QModelIndex()) const override;
index d95db34..ade96f7 100644 (file)
@@ -221,7 +221,7 @@ QModelIndex IgnoreListModel::index(int row, int column, const QModelIndex &paren
 {
     Q_UNUSED(parent);
     if (row >= rowCount() || column >= columnCount())
 {
     Q_UNUSED(parent);
     if (row >= rowCount() || column >= columnCount())
-        return QModelIndex();
+        return {};
 
     return createIndex(row, column);
 }
 
     return createIndex(row, column);
 }
index fb83fd2..4af351e 100644 (file)
@@ -42,7 +42,7 @@ public:
 
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
 
 
     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
 
-    inline QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
+    inline QModelIndex parent(const QModelIndex &) const override { return {}; }
 
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override;
     inline int columnCount(const QModelIndex &parent = QModelIndex()) const override;
 
     inline int rowCount(const QModelIndex &parent = QModelIndex()) const override;
     inline int columnCount(const QModelIndex &parent = QModelIndex()) const override;
index 4eb5ab3..372bafa 100644 (file)
@@ -59,13 +59,13 @@ ShortcutsModel::~ShortcutsModel()
 QModelIndex ShortcutsModel::parent(const QModelIndex &child) const
 {
     if (!child.isValid())
 QModelIndex ShortcutsModel::parent(const QModelIndex &child) const
 {
     if (!child.isValid())
-        return QModelIndex();
+        return {};
 
     auto *item = static_cast<Item *>(child.internalPointer());
     Q_ASSERT(item);
 
     if (!item->parentItem)
 
     auto *item = static_cast<Item *>(child.internalPointer());
     Q_ASSERT(item);
 
     if (!item->parentItem)
-        return QModelIndex();
+        return {};
 
     return createIndex(item->parentItem->row, 0, item->parentItem);
 }
 
     return createIndex(item->parentItem->row, 0, item->parentItem);
 }
index a480467..ca156fa 100644 (file)
@@ -34,13 +34,13 @@ VerticalDockTitle::VerticalDockTitle(QDockWidget *parent)
 
 QSize VerticalDockTitle::sizeHint() const
 {
 
 QSize VerticalDockTitle::sizeHint() const
 {
-    return QSize(8, 15);
+    return {8, 15};
 }
 
 
 QSize VerticalDockTitle::minimumSizeHint() const
 {
 }
 
 
 QSize VerticalDockTitle::minimumSizeHint() const
 {
-    return QSize(8, 10);
+    return {8, 10};
 }
 
 
 }
 
 
index f7bbe93..e6e6e13 100644 (file)
@@ -50,7 +50,7 @@ class EmptyDockTitle : public QWidget
 public:
     inline EmptyDockTitle(QDockWidget *parent) : QWidget(parent) {}
 
 public:
     inline EmptyDockTitle(QDockWidget *parent) : QWidget(parent) {}
 
-    inline QSize sizeHint() const override { return QSize(0, 0); }
+    inline QSize sizeHint() const override { return {0, 0}; }
 };
 
 
 };
 
 
index f131695..620c262 100644 (file)
@@ -605,14 +605,14 @@ QSize BufferView::sizeHint() const
         return TreeViewTouch::sizeHint();
 
     if (model()->rowCount() == 0)
         return TreeViewTouch::sizeHint();
 
     if (model()->rowCount() == 0)
-        return QSize(120, 50);
+        return {120, 50};
 
     int columnSize = 0;
     for (int i = 0; i < model()->columnCount(); i++) {
         if (!isColumnHidden(i))
             columnSize += sizeHintForColumn(i);
     }
 
     int columnSize = 0;
     for (int i = 0; i < model()->columnCount(); i++) {
         if (!isColumnHidden(i))
             columnSize += sizeHintForColumn(i);
     }
-    return QSize(columnSize, 50);
+    return {columnSize, 50};
 }
 
 
 }
 
 
index 8af5024..d722c18 100644 (file)
@@ -32,7 +32,7 @@ FlatProxyModel::FlatProxyModel(QObject *parent)
 QModelIndex FlatProxyModel::mapFromSource(const QModelIndex &sourceIndex) const
 {
     if (!sourceIndex.isValid())
 QModelIndex FlatProxyModel::mapFromSource(const QModelIndex &sourceIndex) const
 {
     if (!sourceIndex.isValid())
-        return QModelIndex();
+        return {};
 
     SourceItem *sourceItem = sourceToInternal(sourceIndex);
     Q_ASSERT(sourceItem);
 
     SourceItem *sourceItem = sourceToInternal(sourceIndex);
     Q_ASSERT(sourceItem);
@@ -43,7 +43,7 @@ QModelIndex FlatProxyModel::mapFromSource(const QModelIndex &sourceIndex) const
 QModelIndex FlatProxyModel::mapToSource(const QModelIndex &proxyIndex) const
 {
     if (!proxyIndex.isValid())
 QModelIndex FlatProxyModel::mapToSource(const QModelIndex &proxyIndex) const
 {
     if (!proxyIndex.isValid())
-        return QModelIndex();
+        return {};
 
     Q_ASSERT(proxyIndex.model() == this);
     Q_ASSERT(_rootSourceItem);
 
     Q_ASSERT(proxyIndex.model() == this);
     Q_ASSERT(_rootSourceItem);
@@ -63,7 +63,7 @@ QModelIndex FlatProxyModel::mapToSource(const QModelIndex &proxyIndex) const
 
     qWarning() << "FlatProxyModel::mapToSource(): couldn't find source index for" << proxyIndex;
     Q_ASSERT(false);
 
     qWarning() << "FlatProxyModel::mapToSource(): couldn't find source index for" << proxyIndex;
     Q_ASSERT(false);
-    return QModelIndex(); // make compilers happy :)
+    return {}; // make compilers happy :)
 }
 
 
 }
 
 
@@ -367,12 +367,12 @@ QModelIndex FlatProxyModel::index(int row, int column, const QModelIndex &parent
 {
     if (parent.isValid()) {
         qWarning() << "FlatProxyModel::index() called with valid parent:" << parent;
 {
     if (parent.isValid()) {
         qWarning() << "FlatProxyModel::index() called with valid parent:" << parent;
-        return QModelIndex();
+        return {};
     }
 
     if (!_rootSourceItem) {
         qWarning() << "FlatProxyModel::index() while model has no root Item";
     }
 
     if (!_rootSourceItem) {
         qWarning() << "FlatProxyModel::index() while model has no root Item";
-        return QModelIndex();
+        return {};
     }
 
     SourceItem *item = _rootSourceItem;
     }
 
     SourceItem *item = _rootSourceItem;
@@ -380,7 +380,7 @@ QModelIndex FlatProxyModel::index(int row, int column, const QModelIndex &parent
         item = item->findChild(row);
         if (!item) {
             qWarning() << "FlatProxyModel::index() no such row:" << row;
         item = item->findChild(row);
         if (!item) {
             qWarning() << "FlatProxyModel::index() no such row:" << row;
-            return QModelIndex();
+            return {};
         }
     }
 
         }
     }
 
@@ -393,7 +393,7 @@ QModelIndex FlatProxyModel::parent(const QModelIndex &index) const
 {
     Q_UNUSED(index)
     // this is a flat model
 {
     Q_UNUSED(index)
     // this is a flat model
-    return QModelIndex();
+    return {};
 }
 
 
 }
 
 
index a6edb66..0112ed1 100644 (file)
@@ -139,11 +139,11 @@ BufferId NetworkModelController::findQueryBuffer(const QModelIndex &index, const
 {
     NetworkId networkId = index.data(NetworkModel::NetworkIdRole).value<NetworkId>();
     if (!networkId.isValid())
 {
     NetworkId networkId = index.data(NetworkModel::NetworkIdRole).value<NetworkId>();
     if (!networkId.isValid())
-        return BufferId();
+        return {};
 
     QString nick = predefinedNick.isEmpty() ? nickName(index) : predefinedNick;
     if (nick.isEmpty())
 
     QString nick = predefinedNick.isEmpty() ? nickName(index) : predefinedNick;
     if (nick.isEmpty())
-        return BufferId();
+        return {};
 
     return findQueryBuffer(networkId, nick);
 }
 
     return findQueryBuffer(networkId, nick);
 }
index 031933a..61679d9 100644 (file)
@@ -630,7 +630,7 @@ QColor QssParser::parseColor(const QString &str)
     if (str.startsWith("rgba")) {
         ColorTuple tuple = parseColorTuple(str.mid(4));
         if (tuple.count() == 4)
     if (str.startsWith("rgba")) {
         ColorTuple tuple = parseColorTuple(str.mid(4));
         if (tuple.count() == 4)
-            return QColor(tuple.at(0), tuple.at(1), tuple.at(2), tuple.at(3));
+            return QColor(tuple.at(0), tuple.at(1), tuple.at(2), tuple.at(3));  // NOLINT(modernize-return-braced-init-list)
     }
     else if (str.startsWith("rgb")) {
         ColorTuple tuple = parseColorTuple(str.mid(3));
     }
     else if (str.startsWith("rgb")) {
         ColorTuple tuple = parseColorTuple(str.mid(3));
index c37522f..2f00795 100644 (file)
@@ -30,7 +30,7 @@ QSize ResizingStackedWidget::sizeHint() const
 {
     QWidget *widget = currentWidget();
     if (!widget)
 {
     QWidget *widget = currentWidget();
     if (!widget)
-        return QSize();
+        return {};
     return widget->sizeHint();
 }
 
     return widget->sizeHint();
 }