qa: Resolve Qt deprecation warnings - default-construct QFlags
[quassel.git] / src / qtui / nicklistwidget.cpp
index 659838a..aae3288 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2018 by the Quassel Project                        *
+ *   Copyright (C) 2005-2020 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -176,8 +176,12 @@ void NickListWidget::rowsAboutToBeRemoved(const QModelIndex& parent, int start,
     }
     else {
         // check if there are explicitly buffers removed
+        // Make sure model is valid first
+        if (!parent.model()) {
+            return;
+        }
         for (int i = start; i <= end; i++) {
-            QVariant variant = parent.child(i, 0).data(NetworkModel::BufferIdRole);
+            QVariant variant = parent.model()->index(i, 0, parent).data(NetworkModel::BufferIdRole);
             if (!variant.isValid())
                 continue;
 
@@ -234,7 +238,7 @@ NickListDock::NickListDock(const QString& title, QWidget* parent)
 void NickListDock::setLocked(bool locked)
 {
     if (locked) {
-        setFeatures(nullptr);
+        setFeatures({});
     }
     else {
         setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);