[education/rkward] rkward: Address more compiler warnings

Thomas Friedrichsmeier null at kde.org
Sat May 14 22:00:07 BST 2022


Git commit c6ba25dc1f249f8d1bd303314503d05ab3b1289c by Thomas Friedrichsmeier.
Committed on 14/05/2022 at 21:00.
Pushed by tfry into branch 'master'.

Address more compiler warnings

M  +1    -1    rkward/dataeditor/rkvareditmodel.cpp
M  +3    -3    rkward/dialogs/rkloadlibsdialog.cpp
M  +2    -2    rkward/misc/editlabelsdialog.cpp
M  +1    -1    rkward/misc/rkaccordiontable.cpp
M  +2    -2    rkward/misc/rkobjectlistview.cpp
M  +1    -1    rkward/rbackend/rcommandstack.cpp
M  +0    -1    rkward/settings/rkrecenturls.cpp

https://invent.kde.org/education/rkward/commit/c6ba25dc1f249f8d1bd303314503d05ab3b1289c

diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index ac0bfd28..ef719692 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -304,7 +304,7 @@ QVariant RKVarEditModel::data (const QModelIndex& index, int role) const {
 Qt::ItemFlags RKVarEditModel::flags (const QModelIndex& index) const {
 	RK_TRACE (EDITOR);
 
-	Qt::ItemFlags flags = 0;
+	Qt::ItemFlags flags = Qt::NoItemFlags;
 
 	if (!index.isValid ()) return flags;
 	int row = index.row ();
diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 3030fdd2..01cf987e 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -1166,13 +1166,13 @@ bool RKRPackageInstallationStatusSortFilterModel::filterAcceptsRow (int source_r
 	if (!source_parent.isValid ()) return true;		// Never filter the top level item
 
 	if (rkward_only) {
-		bool enhance_rk = source_parent.child (source_row, RKRPackageInstallationStatus::EnhancesRKWard).data (Qt::UserRole).toBool ();
+		bool enhance_rk = sourceModel()->index(source_row, RKRPackageInstallationStatus::EnhancesRKWard, source_parent).data(Qt::UserRole).toBool();
 		if (!enhance_rk) return false;
 	}
 // filter on Name and Title
-	QString name = source_parent.child (source_row, RKRPackageInstallationStatus::PackageName).data ().toString ();
+	QString name = sourceModel()->index(source_row, RKRPackageInstallationStatus::PackageName, source_parent).data().toString();
 	if (name.contains (filterRegExp ())) return true;
-	QString title = source_parent.child (source_row, RKRPackageInstallationStatus::PackageTitle).data ().toString ();
+	QString title = sourceModel()->index(source_row, RKRPackageInstallationStatus::PackageTitle, source_parent).data().toString();
 	return (title.contains (filterRegExp ()));
 }
 
diff --git a/rkward/misc/editlabelsdialog.cpp b/rkward/misc/editlabelsdialog.cpp
index eca2ffed..469fd304 100644
--- a/rkward/misc/editlabelsdialog.cpp
+++ b/rkward/misc/editlabelsdialog.cpp
@@ -150,8 +150,8 @@ QVariant RKVarLevelsTableModel::data (const QModelIndex& index, int role) const
 Qt::ItemFlags RKVarLevelsTableModel::flags (const QModelIndex& index) const {
 	RK_TRACE (EDITOR);
 
-	if (!index.isValid ()) return 0;
-	if (index.column () != 0) return 0;
+	if (!index.isValid ()) return Qt::NoItemFlags;
+	if (index.column () != 0) return Qt::NoItemFlags;
 	if (index.row () >= labels.count ()) return (Qt::ItemIsEditable | Qt::ItemIsEnabled);
 	return (Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
 }
diff --git a/rkward/misc/rkaccordiontable.cpp b/rkward/misc/rkaccordiontable.cpp
index a6eff4ce..d7224355 100644
--- a/rkward/misc/rkaccordiontable.cpp
+++ b/rkward/misc/rkaccordiontable.cpp
@@ -283,7 +283,7 @@ RKAccordionTable::~RKAccordionTable () {
 
 void RKAccordionTable::drawRow (QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
 	if (index.parent ().isValid ()) {    // must be the editor widget
-		painter->fillRect (option.rect, palette ().background ());  // fill to paper over any padding around the widget (wherever it comes from)
+		painter->fillRect(option.rect, palette().window());  // fill to paper over any padding around the widget (wherever it comes from)
 		QTreeView::drawRow (painter, option, index);
 		painter->drawLine (option.rect.bottomLeft (), option.rect.bottomRight ());
 	} else {
diff --git a/rkward/misc/rkobjectlistview.cpp b/rkward/misc/rkobjectlistview.cpp
index b30890be..32719db6 100644
--- a/rkward/misc/rkobjectlistview.cpp
+++ b/rkward/misc/rkobjectlistview.cpp
@@ -296,7 +296,7 @@ QWidget* RKObjectListViewSettings::filterWidget (QWidget *parent) {
 	boxvlayout->addWidget (depth_box);
 
 	depth_box->setCurrentIndex (1);
-	connect (depth_box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, &RKObjectListViewSettings::filterSettingsChanged);
+	connect (depth_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &RKObjectListViewSettings::filterSettingsChanged);
 
 	type_box = new QComboBox ();
 	type_box->addItem (i18n ("Show all objects"));
@@ -308,7 +308,7 @@ QWidget* RKObjectListViewSettings::filterWidget (QWidget *parent) {
 	if (hide_functions) type_box->setCurrentIndex (2);
 	else if (hide_non_functions) type_box->setCurrentIndex (1);
 	else type_box->setCurrentIndex (0);
-	connect (type_box, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, &RKObjectListViewSettings::filterSettingsChanged);
+	connect (type_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &RKObjectListViewSettings::filterSettingsChanged);
 
 	QHBoxLayout *bottom_layout = new QHBoxLayout (filter_widget);
 	layout->addLayout (bottom_layout);
diff --git a/rkward/rbackend/rcommandstack.cpp b/rkward/rbackend/rcommandstack.cpp
index dd931ff1..b5af5b02 100644
--- a/rkward/rbackend/rcommandstack.cpp
+++ b/rkward/rbackend/rcommandstack.cpp
@@ -294,7 +294,7 @@ Qt::ItemFlags RCommandStackModel::flags (const QModelIndex& index) const {
 	RK_ASSERT (listeners);
 	RK_TRACE (RBACKEND);
 
-	if (!index.isValid ()) return 0;
+	if (!index.isValid ()) return Qt::NoItemFlags;
 	RK_ASSERT (index.model () == this);
 
 	RCommandChain* index_data = static_cast<RCommandChain*> (index.internalPointer ());
diff --git a/rkward/settings/rkrecenturls.cpp b/rkward/settings/rkrecenturls.cpp
index b1e3a93d..0b1e8b50 100644
--- a/rkward/settings/rkrecenturls.cpp
+++ b/rkward/settings/rkrecenturls.cpp
@@ -132,4 +132,3 @@ void RKRecentUrls::cleanup() {
 	actions.clear();
 }
 
-#include "rkrecenturls.moc"


More information about the rkward-tracker mailing list