View Issue Details

IDProjectCategoryView StatusLast Update
0017290ScribusUser Interfacepublic2025-01-18 16:47
ReporterBN_Dev Assigned To 
PrioritylowSeverityminorReproducibilityalways
Status newResolutionopen 
Platformx86_64OSLinux/macOSOS VersionAll
Product Version1.7.0.svn 
Summary0017290: Plus Minus on Numpad Not Working for Zoom
DescriptionRef: https://forums.scribus.net/index.php/topic,5600.0.html reported by SirMix:
I run Scribus 1.6.1 on Mint 22 and the Plus Minus keys on the numpad are not working in combination with the CTRL-key for zooming in and out.
I can configure the shortcuts in the menu by using the numpad plus/minus keys, but they do not zoom. The CRTL+0 on the numpad works.
Steps To Reproduce1. Go to document canvas
2. Press Ctrl+- (Control and Minus) on primary keyboard [assumes default keyboard shortcuts are set]
3. Observe toolsZoomOut action is invoked
4. Press Ctrl+- (Control and Minus) on numeric keyboard
5. Observe no action is invoked
Additional InformationReason for bug is when the numeric keyboard is used, the keyboard modifier flag Qt::KeypadModifier is set, which is not being matched against the expected shortcut.
Patch removes this flag so the shortcut matching works as expected with the numeric keyboard.
Only tested on KDE/Linux.
TagsNo tags attached.
PatchYes

Activities

BN_Dev

2024-10-16 01:04

reporter  

numpad_shortcuts.patch (1,626 bytes)   
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp	(revision 26312)
+++ scribus/canvasmode.cpp	(working copy)
@@ -1042,7 +1042,7 @@
 void CanvasMode::commonkeyPressEvent_NormalNodeEdit(QKeyEvent *e)
 {
 	int kk = e->key();
-	Qt::KeyboardModifiers buttonModifiers = e->modifiers();
+	Qt::KeyboardModifiers buttonModifiers = e->modifiers() & ~Qt::KeypadModifier;
 	ScribusMainWindow* mainWindow = m_view->m_ScMW;
 	
 	PrefsManager& prefsManager = PrefsManager::instance();
@@ -1082,15 +1082,15 @@
 		scrActions["stickyTools"]->setChecked(false);
 		return;
 	}
-	if (m_view->m_ScMW->actionManager->compareKeySeqToShortcut(kk, e->modifiers(), "toolsZoomIn"))
+	if (m_view->m_ScMW->actionManager->compareKeySeqToShortcut(kk, buttonModifiers, "toolsZoomIn"))
 		scrActions["toolsZoomIn"]->trigger();
-	if (m_view->m_ScMW->actionManager->compareKeySeqToShortcut(kk, e->modifiers(), "toolsZoomOut"))
+	if (m_view->m_ScMW->actionManager->compareKeySeqToShortcut(kk, buttonModifiers, "toolsZoomOut"))
 		scrActions["toolsZoomOut"]->trigger();
 	/**If we have a doc and we are not changing the page or zoom level in the status bar */
 	if ((!m_view->m_ScMW->zoomSpinBox->hasFocus()) && (!m_view->m_ScMW->pageSelector->hasFocus()))
 	{
 		//Show our context menu
-		if (m_view->m_ScMW->actionManager->compareKeySeqToShortcut(kk, e->modifiers(), "viewShowContextMenu"))
+		if (m_view->m_ScMW->actionManager->compareKeySeqToShortcut(kk, buttonModifiers, "viewShowContextMenu"))
 		{
 			ContextMenu* cmen = nullptr;
 			m_view->setCursor(QCursor(Qt::ArrowCursor));
numpad_shortcuts.patch (1,626 bytes)   

BN_Dev

2025-01-18 15:31

reporter   ~0051930

Any update on this being merged please? Many thanks

ale

2025-01-18 16:47

manager   ~0051931

can you please explain what exactly your patch is doing?

i've found a reference to using "modifiers() & Qt::KeypadModifier" on stackoverflow, but can't find any Qt official documentation for it.

if i get it correctly, "buttonModifiers" is used in multiple locations, and i'm not 100% sure that modifying its definition is safe in all cases ("it works for me for + and -" might not be enough to get the patch accepted).

i wonder if Qt::KeypadModifier shouldn't rather be used when storing the value to match in the settings, instead (in the case scribus detects that the key is from the keypad).
but, i did not dig into this enough to be sure.

Issue History

Date Modified Username Field Change
2024-10-16 01:04 BN_Dev New Issue
2024-10-16 01:04 BN_Dev File Added: numpad_shortcuts.patch
2025-01-18 15:31 BN_Dev Note Added: 0051930
2025-01-18 16:47 ale Note Added: 0051931