[education/rkward] /: Fix a few more deprecation warnings.

Thomas Friedrichsmeier null at kde.org
Sun Jul 3 10:25:03 BST 2022


Git commit c5f5b1739003a8d3322a8071cdc2831721e87845 by Thomas Friedrichsmeier.
Committed on 03/07/2022 at 09:24.
Pushed by tfry into branch 'master'.

Fix a few more deprecation warnings.

M  +1    -0    ChangeLog
M  +11   -3    rkward/rkward.cpp
M  +10   -1    rkward/windows/rkcommandeditorwindow.cpp

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

diff --git a/ChangeLog b/ChangeLog
index 3089e616..fb18eaec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- Fixed: Menubar would disapper after opening script editor, in some configurations
 - Fixed: Very long error messages during R markdown preview could cause the preview window to become too wide
 - Many new basic and advanced R, R Markdown and LaTeX snippets
 	- Complex R Markdown template part of the snippets
diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index cc9cf057..0d107b67 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -37,6 +37,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <KSharedConfig>
 #include <KConfigGroup>
 #include <KColorScheme>
+#include <kwidgetsaddons_version.h>
 
 // application specific includes
 #include "core/rkmodificationtracker.h"
@@ -583,7 +584,6 @@ void RKWardMainWindow::initActions() {
 
 	// collections for the toolbar:
 	open_any_action = new KActionMenu (QIcon::fromTheme("document-open-folder"), i18n ("Open..."), this);
-	open_any_action->setDelayed (false);
 	actionCollection ()->addAction ("open_any", open_any_action);
 
 	open_any_action->addAction (fileOpenWorkspace);
@@ -598,7 +598,6 @@ void RKWardMainWindow::initActions() {
 	//open_any_action->addAction (proxy_import); -> later
 
 	KActionMenu* new_any_action = new KActionMenu (QIcon::fromTheme("document-new"), i18n ("Create..."), this);
-	new_any_action->setDelayed (false);
 	actionCollection ()->addAction ("new_any", new_any_action);
 
 	new_any_action->addAction (new_data_frame);
@@ -606,9 +605,18 @@ void RKWardMainWindow::initActions() {
 	new_any_action->addAction (new_output);
 
 	save_any_action = new KActionMenu (QIcon::fromTheme("document-save"), i18n ("Save..."), this);
-	save_any_action->setDelayed (false);
 	actionCollection ()->addAction ("save_any", save_any_action);
 
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
+	open_any_action->setPopupMode(QToolButton::InstantPopup);
+	new_any_action->setPopupMode(QToolButton::InstantPopup);
+	save_any_action->setPopupMode(QToolButton::InstantPopup);
+#else
+	open_any_action->setDelayed(false);
+	new_any_action->setDelayed(false);
+	save_any_action->setDelayed(false);
+#endif
+
 	save_any_action->addAction (fileSaveWorkspace);
 	save_any_action->addAction (fileSaveWorkspaceAs);
 	save_any_action->addSeparator ();
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 8f47b5e2..cd9b9d23 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -39,6 +39,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <kio/job.h>
 #include <kconfiggroup.h>
 #include <krandom.h>
+#include <kwidgetsaddons_version.h>
 
 #include "../misc/rkcommonfunctions.h"
 #include "../misc/rkstandardicons.h"
@@ -361,7 +362,11 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
 	RKStandardActions::onlineHelp (this, this);
 
 	actionmenu_run_block = new KActionMenu (i18n ("Run block"), this);
-	actionmenu_run_block->setDelayed (false);	// KDE4: TODO does not work correctly in the tool bar.
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
+	actionmenu_run_block->setPopupMode(QToolButton::InstantPopup);
+#else
+	actionmenu_run_block->setDelayed(false);
+#endif
 	ac->addAction ("run_block", actionmenu_run_block);
 	connect (actionmenu_run_block->menu(), &QMenu::aboutToShow, this, &RKCommandEditorWindow::clearUnusedBlocks);
 	actionmenu_mark_block = new KActionMenu (i18n ("Mark selection as block"), this);
@@ -378,7 +383,11 @@ void RKCommandEditorWindow::initializeActions (KActionCollection* ac) {
 	action_setwd_to_script->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionCDToScript));
 
 	KActionMenu* actionmenu_preview = new KActionMenu (QIcon::fromTheme ("view-preview"), i18n ("Preview"), this);
+#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
+	actionmenu_preview->setPopupMode(QToolButton::InstantPopup);
+#else
 	actionmenu_preview->setDelayed (false);
+#endif
 	preview_modes = new QActionGroup (this);
 	actionmenu_preview->addAction (action_no_preview = new QAction (RKStandardIcons::getIcon (RKStandardIcons::ActionDelete), i18n ("No preview"), preview_modes));
 	actionmenu_preview->addAction (new QAction (QIcon::fromTheme ("preview_math"), i18n ("R Markdown"), preview_modes));


More information about the rkward-tracker mailing list