Skip to content

Commit cd8f2f1

Browse files
jgrochanyalldawson
authored andcommittedJun 17, 2019
Fix attribute table shortcuts when docked [needs-docs]
Closes #29633, fix #29945
1 parent 24e56a8 commit cd8f2f1

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed
 

‎src/app/qgsattributetabledialog.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,18 @@ void QgsAttributeTableDialog::toggleDockMode( bool docked )
11931193
connect( this, &QObject::destroyed, mDock, &QWidget::close );
11941194
QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock );
11951195
updateTitle();
1196+
1197+
// To prevent "QAction::event: Ambiguous shortcut overload"
1198+
QgsDebugMsgLevel( QStringLiteral( "Remove shortcuts from attribute table already defined in main window" ), 2 );
1199+
mActionCopySelectedRows->setShortcut( QKeySequence() );
1200+
mActionPasteFeatures->setShortcut( QKeySequence() );
1201+
mActionCutSelectedRows->setShortcut( QKeySequence() );
1202+
mActionZoomMapToSelectedRows->setShortcut( QKeySequence() );
1203+
mActionRemoveSelection->setShortcut( QKeySequence() );
1204+
mActionSelectAll->setShortcut( QKeySequence() );
1205+
// duplicated on Main Window, with different semantics
1206+
mActionPanMapToSelectedRows->setShortcut( QKeySequence() );
1207+
mActionSearchForm->setShortcut( QKeySequence() );
11961208
}
11971209
else
11981210
{
@@ -1221,6 +1233,19 @@ void QgsAttributeTableDialog::toggleDockMode( bool docked )
12211233
updateTitle();
12221234
mDialog->restoreGeometry( QgsSettings().value( QStringLiteral( "Windows/BetterAttributeTable/geometry" ) ).toByteArray() );
12231235
mDialog->show();
1236+
1237+
// restore attribute table shortcuts in window mode
1238+
QgsDebugMsgLevel( QStringLiteral( "Restore attribute table dialog shortcuts in window mode" ), 2 );
1239+
// duplicated on Main Window
1240+
mActionCopySelectedRows->setShortcut( QKeySequence( QKeySequence::Copy ) );
1241+
mActionPasteFeatures->setShortcut( QKeySequence( QKeySequence::Paste ) );
1242+
mActionCutSelectedRows->setShortcut( QKeySequence( QKeySequence::Cut ) );
1243+
mActionZoomMapToSelectedRows->setShortcut( QStringLiteral( "Ctrl+J" ) );
1244+
mActionRemoveSelection->setShortcut( QStringLiteral( "Ctrl+Shift+A" ) );
1245+
mActionSelectAll->setShortcut( QStringLiteral( "Ctrl+A" ) );
1246+
// duplicated on Main Window, with different semantics
1247+
mActionPanMapToSelectedRows->setShortcut( QStringLiteral( "Ctrl+P" ) );
1248+
mActionSearchForm->setShortcut( QStringLiteral( "Ctrl+F" ) );
12241249
}
12251250
}
12261251

‎src/ui/qgsattributetabledialog.ui

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@
393393
<property name="toolTip">
394394
<string>Save edits (Ctrl+S)</string>
395395
</property>
396-
<property name="shortcut">
397-
<string>Ctrl+S</string>
398-
</property>
399396
</action>
400397
<action name="mActionReload">
401398
<property name="icon">
@@ -591,9 +588,6 @@
591588
<property name="toolTip">
592589
<string>Delete field (Ctrl+L)</string>
593590
</property>
594-
<property name="shortcut">
595-
<string>Ctrl+L</string>
596-
</property>
597591
</action>
598592
<action name="mActionAddAttribute">
599593
<property name="icon">

0 commit comments

Comments
 (0)
Please sign in to comment.