[education/rkward] rkward: Improve context menu event handling in console

Thomas Friedrichsmeier null at kde.org
Thu Aug 7 20:25:42 BST 2025


Git commit bee78f2bf042dbc4a0cad59d7ecd9b32f12ffca3 by Thomas Friedrichsmeier.
Committed on 07/08/2025 at 19:25.
Pushed by tfry into branch 'master'.

Improve context menu event handling in console

CCBUG: 507923

M  +3    -8    rkward/rkconsole.cpp

https://invent.kde.org/education/rkward/-/commit/bee78f2bf042dbc4a0cad59d7ecd9b32f12ffca3

diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 979e3569e..42b8e752f 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -339,14 +339,9 @@ bool RKConsole::eventFilter(QObject *o, QEvent *e) {
 	if ((e->type() == QEvent::KeyPress) || (e->type() == QEvent::Shortcut)) {
 		QKeyEvent *k = static_cast<QKeyEvent *>(e);
 		return (handleKeyPress(k));
-	} else if (e->type() == QEvent::MouseButtonPress) {
-		// we seem to need this, as the kateview will swallow the contextMenuEvent, otherwise
-		QMouseEvent *m = (QMouseEvent *)e;
-		if (m->button() == Qt::RightButton) {
-			QPoint pos = m->globalPosition().toPoint();
-			qApp->sendEvent(this, new QContextMenuEvent(QContextMenuEvent::Mouse, mapFromGlobal(pos), pos));
-			return (true);
-		}
+	} else if (e->type() == QEvent::ContextMenu) {
+		contextMenuEvent(static_cast<QContextMenuEvent *>(e));
+		return true;
 	} else if (e->type() == QEvent::MouseButtonRelease) {
 		QMouseEvent *m = (QMouseEvent *)e;
 		if (m->button() == Qt::MiddleButton) {


More information about the rkward-tracker mailing list