[education/rkward] rkward/windows: Silence clazy warning

Thomas Friedrichsmeier null at kde.org
Sun Apr 10 11:54:26 BST 2022


Git commit c2c66c0d519d832102f45b93510a4604633d991e by Thomas Friedrichsmeier.
Committed on 10/04/2022 at 08:09.
Pushed by tfry into branch 'master'.

Silence clazy warning

M  +7    -5    rkward/windows/katepluginintegration.cpp

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

diff --git a/rkward/windows/katepluginintegration.cpp b/rkward/windows/katepluginintegration.cpp
index c87b5cba..0b57624a 100644
--- a/rkward/windows/katepluginintegration.cpp
+++ b/rkward/windows/katepluginintegration.cpp
@@ -344,12 +344,14 @@ public:
 /** This is a bit lame, but the plugin does not add itself to the parent widget's layout by itself. So we need this override
  *  to do that. Where did the good old KVBox go? */
 	void childEvent(QChildEvent *ev) override {
-		if ((ev->type() == QEvent::ChildAdded) && qobject_cast<QWidget *>(ev->child())) {
-			QWidget *widget = qobject_cast<QWidget *>(ev->child());
-			layout()->addWidget(widget);
-			setFocusProxy(widget);
+		if ((ev->type() == QEvent::ChildAdded) && ev->child()->isWidgetType()) {
+			QWidget *widget = qobject_cast<QWidget *>(ev->child()); // clazy:exclude=child-event-qobject-cast - Cast to QWidget is ok, we checked for widgetType(), above
+			if (widget) {
+				layout()->addWidget(widget);
+				setFocusProxy(widget);
+			}
 		}
-		QWidget::childEvent(ev);
+		RKMDIWindow::childEvent(ev);
 	}
 };
 



More information about the rkward-tracker mailing list