Skip to content
Permalink
Browse files

Limit scope of Ctrl+C shortcut for copy features to canvas and for

python console to console widget

Avoids ambiguous shortcut warnings/unexpected behavior when pressing
Ctrl+C

Fixes #27035
Fixes #31918
Fixes #31914
Fixes #31392
  • Loading branch information
nyalldawson committed Jun 4, 2020
1 parent 2f4e8c0 commit 873716c6fa17298868060a6517205ad7bea78a72
Showing with 6 additions and 3 deletions.
  1. +1 −0 python/console/console_output.py
  2. +5 −0 src/app/qgisapp.cpp
  3. +0 −3 src/ui/qgisapp.ui
@@ -168,6 +168,7 @@ def __init__(self, parent=None):
self.runScut.activated.connect(self.enteredSelected)
# Reimplemented copy action to prevent paste prompt (>>>,...) in command view
self.copyShortcut = QShortcut(QKeySequence.Copy, self)
self.copyShortcut.setContext(Qt.WidgetWithChildrenShortcut)
self.copyShortcut.activated.connect(self.copy)
self.selectAllShortcut = QShortcut(QKeySequence.SelectAll, self)
self.selectAllShortcut.activated.connect(self.selectAll)
@@ -2816,6 +2816,11 @@ void QgisApp::createActions()

connect( mActionDiagramProperties, &QAction::triggered, this, &QgisApp::diagramProperties );

// we can't set the shortcut on the copy action, because we need to restrict it's context to the canvas and it's children..
QShortcut *copyShortcut = new QShortcut( QKeySequence::Copy, mMapCanvas );
copyShortcut->setContext( Qt::WidgetWithChildrenShortcut );
connect( copyShortcut, &QShortcut::activated, this, [ = ] { copySelectionToClipboard(); } );

#ifndef HAVE_POSTGRESQL
delete mActionAddPgLayer;
mActionAddPgLayer = 0;
@@ -894,9 +894,6 @@
<property name="text">
<string>Copy Features</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="mActionPasteFeatures">
<property name="icon">

0 comments on commit 873716c

Please sign in to comment.
You can’t perform that action at this time.