[education/rkward/kf5] rkward: Fix more deprecation warnings
Thomas Friedrichsmeier
null at kde.org
Wed Apr 10 16:12:08 BST 2024
Git commit 426067ab127352f239b66cdced3574308ca5c60b by Thomas Friedrichsmeier.
Committed on 05/04/2024 at 09:26.
Pushed by tfry into branch 'kf5'.
Fix more deprecation warnings
M +4 -3 rkward/rkconsole.cpp
M +2 -2 rkward/rkward.cpp
M +1 -1 rkward/windows/katepluginintegration.cpp
M +4 -4 rkward/windows/rktoolwindowlist.cpp
M +4 -3 rkward/windows/rktoolwindowlist.h
https://invent.kde.org/education/rkward/-/commit/426067ab127352f239b66cdced3574308ca5c60b
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 7d67b79d3..aee316a53 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -373,7 +373,8 @@ bool RKConsole::eventFilter (QObject *o, QEvent *e) {
// we seem to need this, as the kateview will swallow the contextMenuEvent, otherwise
QMouseEvent *m = (QMouseEvent *)e;
if (m->button() == Qt::RightButton) {
- qApp->sendEvent (this, new QContextMenuEvent (QContextMenuEvent::Other, m->globalPos ()));
+ QPoint pos = m->globalPosition().toPoint();
+ qApp->sendEvent(this, new QContextMenuEvent(QContextMenuEvent::Mouse, mapFromGlobal(pos), pos));
return (true);
}
} else if (e->type () == QEvent::MouseButtonRelease){
@@ -401,7 +402,7 @@ bool RKConsole::eventFilter (QObject *o, QEvent *e) {
// We try to map it back to the view, correctly.
QWidget *rec = dynamic_cast<QWidget*> (o);
if (!o) rec = view;
- KTextEditor::Cursor pos = view->coordinatesToCursor (rec->mapTo (view, me->pos ()));
+ KTextEditor::Cursor pos = view->coordinatesToCursor(rec->mapTo(view, me->position().toPoint()));
bool in_last_line = (pos.line () == doc->lines () - 1) && (pos.column () >= prefix.length ());
if (!in_last_line) {
@@ -936,7 +937,7 @@ void RKConsole::contextMenuEvent (QContextMenuEvent * event) {
copy_literal_action->setEnabled (view->selection ());
run_selection_action->setEnabled (view->selection ());
- console_part->showPopupMenu (event->pos ());
+ console_part->showPopupMenu(event->globalPos());
run_selection_action->setEnabled (true);
copy_literal_action->setEnabled (true);
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index f0494a1a9..a527f1a8d 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -1,6 +1,6 @@
/*
rkward.cpp - This file is part of RKWard (https://rkward.kde.org). Created: Tue Oct 29 2002
-SPDX-FileCopyrightText: 2002-2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2002-2024 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
@@ -464,7 +464,7 @@ void RKWardMainWindow::initToolViewsAndR () {
RKDebugMessageWindow::_instance = new RKDebugMessageWindow(nullptr, true);
RKDebugMessageWindow::instance ()->setCaption (i18n ("RKWard Debug Messages"));
- RKToolWindowList::registerToolWindow (RKDebugMessageWindow::instance (), "rkdebugmessages", RKToolWindowList::Nowhere, 0);
+ RKToolWindowList::registerToolWindow (RKDebugMessageWindow::instance (), "rkdebugmessages", RKToolWindowList::Nowhere, QKeyCombination());
RKWorkplace::mainWorkplace ()->placeToolWindows ();
}
diff --git a/rkward/windows/katepluginintegration.cpp b/rkward/windows/katepluginintegration.cpp
index 9166c07f2..477567c14 100644
--- a/rkward/windows/katepluginintegration.cpp
+++ b/rkward/windows/katepluginintegration.cpp
@@ -380,7 +380,7 @@ QWidget* KatePluginIntegrationWindow::createToolView (KTextEditor::Plugin *plugi
KatePluginWindow *window = new KatePluginWindow(RKWorkplace::mainWorkplace()->view(), true);
window->setCaption(text);
window->setWindowIcon(icon);
- RKToolWindowList::registerToolWindow(window, identifier, (RKToolWindowList::Placement) pos, 0);
+ RKToolWindowList::registerToolWindow(window, identifier, (RKToolWindowList::Placement) pos, QKeyCombination());
RKWorkplace::mainWorkplace()->placeInToolWindowBar(window, pos);
plugin_resources[plugin].windows.append(window);
diff --git a/rkward/windows/rktoolwindowlist.cpp b/rkward/windows/rktoolwindowlist.cpp
index 2d732ac60..b48955302 100644
--- a/rkward/windows/rktoolwindowlist.cpp
+++ b/rkward/windows/rktoolwindowlist.cpp
@@ -1,6 +1,6 @@
/*
rktoolwindowlist - This file is part of RKWard (https://rkward.kde.org). Created: Thu Apr 07 2011
-SPDX-FileCopyrightText: 2011 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2011-2024 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
@@ -18,18 +18,18 @@ QList<RKToolWindowList::ToolWindowRepresentation>& RKToolWindowList::registeredT
return RKToolWindowListPrivate::registered_tool_windows;
}
-void RKToolWindowList::registerToolWindow (RKMDIWindow *window, const QString &id, Placement default_placement, int default_shortcut) {
+void RKToolWindowList::registerToolWindow (RKMDIWindow *window, const QString &id, Placement default_placement, const QKeyCombination& default_shortcut) {
RK_TRACE (APP);
ToolWindowRepresentation tr;
tr.window = window;
tr.id = id;
tr.default_placement = default_placement;
+ tr.default_shortcut = default_shortcut;
#ifdef Q_OS_MACOS
// HACK: Workaround for shortcut conflict issue: https://mail.kde.org/pipermail/rkward-devel/2011-December/003153.html
- if (default_shortcut & Qt::AltModifier) default_shortcut |= Qt::ControlModifier;
+ if (default_shortcut & Qt::AltModifier) tr.default_shortcut |= Qt::ControlModifier;
#endif
- tr.default_shortcut = default_shortcut;
RKToolWindowListPrivate::registered_tool_windows.append (tr);
}
diff --git a/rkward/windows/rktoolwindowlist.h b/rkward/windows/rktoolwindowlist.h
index f03c59d60..940aef3e3 100644
--- a/rkward/windows/rktoolwindowlist.h
+++ b/rkward/windows/rktoolwindowlist.h
@@ -1,6 +1,6 @@
/*
rktoolwindowlist - This file is part of the RKWard project. Created: Thu Apr 07 2011
-SPDX-FileCopyrightText: 2011 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
+SPDX-FileCopyrightText: 2011-2024 by Thomas Friedrichsmeier <thomas.friedrichsmeier at kdemail.net>
SPDX-FileContributor: The RKWard Team <rkward-devel at kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
@@ -10,6 +10,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include <QList>
#include <QString>
+#include <QKeyCombination>
class RKMDIWindow;
@@ -27,10 +28,10 @@ namespace RKToolWindowList {
RKMDIWindow *window;
QString id;
Placement default_placement;
- int default_shortcut;
+ QKeyCombination default_shortcut;
};
- void registerToolWindow (RKMDIWindow *window, const QString &id, Placement default_placement, int default_shortcut);
+ void registerToolWindow (RKMDIWindow *window, const QString &id, Placement default_placement, const QKeyCombination& default_shortcut);
void unregisterToolWindow (RKMDIWindow *window);
RKMDIWindow* findToolWindowById (const QString &id);
QString idOfWindow (RKMDIWindow *window);
More information about the rkward-tracker
mailing list