Skip to content
Permalink
Browse files

Limit scope of Ctrl+{A,X,C,V} shortcut for attribue table

  • Loading branch information
nirvn committed Jun 4, 2020
1 parent 82199f1 commit b923b3da1f1531a19fdc808dfc5a0caf3c92b7b0
Showing with 9 additions and 20 deletions.
  1. +9 −8 src/app/qgsattributetabledialog.cpp
  2. +0 −12 src/ui/qgsattributetabledialog.ui
@@ -114,6 +114,15 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr
connect( mActionExpressionSelect, &QAction::triggered, this, &QgsAttributeTableDialog::mActionExpressionSelect_triggered );
connect( mMainView, &QgsDualView::showContextMenuExternally, this, &QgsAttributeTableDialog::showContextMenu );

mActionSelectAll->setShortcuts( QKeySequence::SelectAll );
mActionSelectAll->setShortcutContext( Qt::WidgetWithChildrenShortcut );
mActionCopySelectedRows->setShortcuts( QKeySequence::Copy );
mActionCopySelectedRows->setShortcutContext( Qt::WidgetWithChildrenShortcut );
mActionCutSelectedRows->setShortcuts( QKeySequence::Cut );
mActionCutSelectedRows->setShortcutContext( Qt::WidgetWithChildrenShortcut );
mActionPasteFeatures->setShortcuts( QKeySequence::Paste );
mActionPasteFeatures->setShortcutContext( Qt::WidgetWithChildrenShortcut );

const QgsFields fields = mLayer->fields();
for ( const QgsField &field : fields )
{
@@ -933,12 +942,8 @@ void QgsAttributeTableDialog::toggleDockMode( bool docked )

// To prevent "QAction::event: Ambiguous shortcut overload"
QgsDebugMsgLevel( QStringLiteral( "Remove shortcuts from attribute table already defined in main window" ), 2 );
mActionCopySelectedRows->setShortcut( QKeySequence() );
mActionPasteFeatures->setShortcut( QKeySequence() );
mActionCutSelectedRows->setShortcut( QKeySequence() );
mActionZoomMapToSelectedRows->setShortcut( QKeySequence() );
mActionRemoveSelection->setShortcut( QKeySequence() );
mActionSelectAll->setShortcut( QKeySequence() );
// duplicated on Main Window, with different semantics
mActionPanMapToSelectedRows->setShortcut( QKeySequence() );
mActionSearchForm->setShortcut( QKeySequence() );
@@ -974,12 +979,8 @@ void QgsAttributeTableDialog::toggleDockMode( bool docked )
// restore attribute table shortcuts in window mode
QgsDebugMsgLevel( QStringLiteral( "Restore attribute table dialog shortcuts in window mode" ), 2 );
// duplicated on Main Window
mActionCopySelectedRows->setShortcut( QKeySequence( QKeySequence::Copy ) );
mActionPasteFeatures->setShortcut( QKeySequence( QKeySequence::Paste ) );
mActionCutSelectedRows->setShortcut( QKeySequence( QKeySequence::Cut ) );
mActionZoomMapToSelectedRows->setShortcut( QStringLiteral( "Ctrl+J" ) );
mActionRemoveSelection->setShortcut( QStringLiteral( "Ctrl+Shift+A" ) );
mActionSelectAll->setShortcut( QStringLiteral( "Ctrl+A" ) );
// duplicated on Main Window, with different semantics
mActionPanMapToSelectedRows->setShortcut( QStringLiteral( "Ctrl+P" ) );
mActionSearchForm->setShortcut( QStringLiteral( "Ctrl+F" ) );
@@ -339,9 +339,6 @@
<property name="toolTip">
<string>Select all (Ctrl+A)</string>
</property>
<property name="shortcut">
<string>Ctrl+A</string>
</property>
</action>
<action name="mActionInvertSelection">
<property name="icon">
@@ -429,9 +426,6 @@
<property name="toolTip">
<string>Cut selected rows to clipboard (Ctrl+X)</string>
</property>
<property name="shortcut">
<string>Ctrl+X</string>
</property>
</action>
<action name="mActionCopySelectedRows">
<property name="icon">
@@ -444,9 +438,6 @@
<property name="toolTip">
<string>Copy selected rows to clipboard (Ctrl+C)</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="mActionPasteFeatures">
<property name="icon">
@@ -459,9 +450,6 @@
<property name="toolTip">
<string>Paste features from clipboard (Ctrl+V)</string>
</property>
<property name="shortcut">
<string>Ctrl+V</string>
</property>
</action>
<action name="mActionRemoveAttribute">
<property name="icon">

0 comments on commit b923b3d

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