[rkward] rkward: Fix more compiler warnings (QStyleOptionViewItemVx)

Thomas Friedrichsmeier null at kde.org
Fri Apr 20 09:55:05 UTC 2018


Git commit 65dbd6a35b9621570a2f1e18935c9e671813a3a2 by Thomas Friedrichsmeier.
Committed on 20/04/2018 at 09:54.
Pushed by tfry into branch 'master'.

Fix more compiler warnings (QStyleOptionViewItemVx)

M  +7    -12   rkward/dialogs/rkloadlibsdialog.cpp
M  +3    -8    rkward/misc/rkaccordiontable.cpp
M  +8    -13   rkward/misc/rkobjectlistview.cpp

https://commits.kde.org/rkward/65dbd6a35b9621570a2f1e18935c9e671813a3a2

diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp
index 62d7c627..91c26c20 100644
--- a/rkward/dialogs/rkloadlibsdialog.cpp
+++ b/rkward/dialogs/rkloadlibsdialog.cpp
@@ -2,7 +2,7 @@
                           rkloadlibsdialog  -  description
                              -------------------
     begin                : Mon Sep 6 2004
-    copyright            : (C) 2004 - 2016 by Thomas Friedrichsmeier
+    copyright            : (C) 2004 - 2018 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -648,21 +648,16 @@ public:
 	void initStyleOption (QStyleOptionViewItem* option, const QModelIndex& index) const override {
 		QStyledItemDelegate::initStyleOption (option, index);
 		if (!index.parent ().isValid ()) {
-			QStyleOptionViewItemV4 *v4 = qstyleoption_cast<QStyleOptionViewItemV4 *> (option);
-			if (!v4) {
-				RK_ASSERT (false);
-				return;
-			}
 			int ccount = index.model ()->rowCount (index);
-			v4->text = v4->text + " (" + QString::number (ccount) + ')';
+			option->text = option->text + " (" + QString::number (ccount) + ')';
 			if (ccount) {
-				v4->icon = table->isExpanded (index) ? expanded : collapsed;
+				option->icon = table->isExpanded (index) ? expanded : collapsed;
 			} else {
-				v4->icon = QIcon ();    // empty dummy icon to reserve space
+				option->icon = QIcon ();    // empty dummy icon to reserve space
 			}
-			v4->features |= QStyleOptionViewItemV2::HasDecoration;
-			v4->font.setBold (true);
-			v4->backgroundBrush = table->palette ().mid ();
+			option->features |= QStyleOptionViewItem::HasDecoration;
+			option->font.setBold (true);
+			option->backgroundBrush = table->palette ().mid ();
 		}
 	}
 	QTreeView* table;
diff --git a/rkward/misc/rkaccordiontable.cpp b/rkward/misc/rkaccordiontable.cpp
index 7d64f44b..a920e06f 100644
--- a/rkward/misc/rkaccordiontable.cpp
+++ b/rkward/misc/rkaccordiontable.cpp
@@ -2,7 +2,7 @@
                           rkaccordiontable  -  description
                              -------------------
     begin                : Fri Oct 24 2015
-    copyright            : (C) 2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2015-2018 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -231,13 +231,8 @@ public:
 	void initStyleOption (QStyleOptionViewItem* option, const QModelIndex& index) const override {
 		QStyledItemDelegate::initStyleOption (option, index);
 		if (!pmodel->isFake (index)) {
-			QStyleOptionViewItemV4 *v4 = qstyleoption_cast<QStyleOptionViewItemV4 *> (option);
-			if (!v4) {
-				RK_ASSERT (false);
-				return;
-			}
-			v4->icon = table->isExpanded (index) ? expanded : collapsed;
-			v4->features |= QStyleOptionViewItemV2::HasDecoration;
+			option->icon = table->isExpanded (index) ? expanded : collapsed;
+			option->features |= QStyleOptionViewItem::HasDecoration;
 		}
 	}
 	RKAccordionDummyModel *pmodel;
diff --git a/rkward/misc/rkobjectlistview.cpp b/rkward/misc/rkobjectlistview.cpp
index 523141ed..832c51b9 100644
--- a/rkward/misc/rkobjectlistview.cpp
+++ b/rkward/misc/rkobjectlistview.cpp
@@ -2,7 +2,7 @@
                           rkobjectlistview  -  description
                              -------------------
     begin                : Wed Sep 1 2004
-    copyright            : (C) 2004-2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2004-2018 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -51,23 +51,18 @@ public:
 	void initStyleOption (QStyleOptionViewItem* option, const QModelIndex& index) const override {
 		QStyledItemDelegate::initStyleOption (option, index);
 		if (!index.parent ().isValid ()) {
-			QStyleOptionViewItemV4 *v4 = qstyleoption_cast<QStyleOptionViewItemV4 *> (option);
-			if (!v4) {
-				RK_ASSERT (false);
-				return;
-			}
-			v4->icon = tree->isExpanded (index) ? expanded : collapsed;
+			option->icon = tree->isExpanded (index) ? expanded : collapsed;
 			//v4->decorationPosition = QStyleOptionViewItemV4::Right;  // easily gets out of the picture, thus using left-align
-			v4->features |= QStyleOptionViewItemV2::HasDecoration;
+			option->features |= QStyleOptionViewItem::HasDecoration;
 
 			RObject* object = static_cast<RObject*> (tree->settings->mapToSource (index).internalPointer ());
-			v4->font.setBold (true);
-			v4->backgroundBrush = tree->palette ().mid ();
+			option->font.setBold (true);
+			option->backgroundBrush = tree->palette ().mid ();
 			if (object == RObjectList::getObjectList ()) {
-				v4->text = i18n ("Other Environments");
+				option->text = i18n ("Other Environments");
 			} else {
-				if (tree->model ()->hasChildren (index)) v4->text = i18n ("My Workspace");
-				else v4->text = i18n ("My Workspace (no objects matching filter)");
+				if (tree->model ()->hasChildren (index)) option->text = i18n ("My Workspace");
+				else option->text = i18n ("My Workspace (no objects matching filter)");
 			}
 		}
 	}



More information about the rkward-tracker mailing list