Fix attribute table shortcuts when docked [needs-docs]

Closes #29633, fix #29945
This commit is contained in:
Jorge Gustavo Rocha 2019-06-17 21:19:27 +01:00 committed by Nyall Dawson
parent 24e56a810c
commit cd8f2f1e00
2 changed files with 25 additions and 6 deletions

View File

@ -1193,6 +1193,18 @@ void QgsAttributeTableDialog::toggleDockMode( bool docked )
connect( this, &QObject::destroyed, mDock, &QWidget::close ); connect( this, &QObject::destroyed, mDock, &QWidget::close );
QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock ); QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock );
updateTitle(); updateTitle();
// 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() );
} }
else else
{ {
@ -1221,6 +1233,19 @@ void QgsAttributeTableDialog::toggleDockMode( bool docked )
updateTitle(); updateTitle();
mDialog->restoreGeometry( QgsSettings().value( QStringLiteral( "Windows/BetterAttributeTable/geometry" ) ).toByteArray() ); mDialog->restoreGeometry( QgsSettings().value( QStringLiteral( "Windows/BetterAttributeTable/geometry" ) ).toByteArray() );
mDialog->show(); mDialog->show();
// 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" ) );
} }
} }

View File

@ -393,9 +393,6 @@
<property name="toolTip"> <property name="toolTip">
<string>Save edits (Ctrl+S)</string> <string>Save edits (Ctrl+S)</string>
</property> </property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action> </action>
<action name="mActionReload"> <action name="mActionReload">
<property name="icon"> <property name="icon">
@ -591,9 +588,6 @@
<property name="toolTip"> <property name="toolTip">
<string>Delete field (Ctrl+L)</string> <string>Delete field (Ctrl+L)</string>
</property> </property>
<property name="shortcut">
<string>Ctrl+L</string>
</property>
</action> </action>
<action name="mActionAddAttribute"> <action name="mActionAddAttribute">
<property name="icon"> <property name="icon">