mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
Use standardKey instead of hardcoded F1
This commit is contained in:
parent
88417360f3
commit
b137461998
@ -185,7 +185,7 @@ class Editor(QgsCodeEditorPython):
|
||||
force_search=True,
|
||||
)
|
||||
)
|
||||
context_help_action.setShortcut("F1")
|
||||
context_help_action.setShortcut(QKeySequence.StandardKey.HelpContents)
|
||||
menu.addAction(context_help_action)
|
||||
|
||||
start_action = QAction(
|
||||
|
@ -295,7 +295,7 @@ class ShellOutputScintilla(QgsCodeEditorPython):
|
||||
context_help_action.triggered.connect(
|
||||
partial(self.shell_editor.showApiDocumentation, word, force_search=True)
|
||||
)
|
||||
context_help_action.setShortcut("F1")
|
||||
context_help_action.setShortcut(QKeySequence.StandardKey.HelpContents)
|
||||
menu.addAction(context_help_action)
|
||||
|
||||
menu.addSeparator()
|
||||
|
@ -547,5 +547,5 @@ class ShellScintilla(QgsCodeEditorPython):
|
||||
context_help_action.triggered.connect(
|
||||
partial(self.showApiDocumentation, word, force_search=True)
|
||||
)
|
||||
context_help_action.setShortcut("F1")
|
||||
context_help_action.setShortcut(QKeySequence.StandardKey.HelpContents)
|
||||
menu.addAction(context_help_action)
|
||||
|
@ -204,7 +204,7 @@ void QgsCodeEditor::keyPressEvent( QKeyEvent *event )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( event->key() == Qt::Key_F1 )
|
||||
if ( event->matches( QKeySequence::StandardKey::HelpContents ) )
|
||||
{
|
||||
// Check if some text is selected
|
||||
QString text = selectedText();
|
||||
@ -365,7 +365,7 @@ bool QgsCodeEditor::event( QEvent *event )
|
||||
{
|
||||
if ( QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>( event ) )
|
||||
{
|
||||
if ( keyEvent->key() == Qt::Key_F1 )
|
||||
if ( keyEvent->matches( QKeySequence::StandardKey::HelpContents ) )
|
||||
{
|
||||
// If the user pressed F1, we want to prevent the main help dialog to show
|
||||
// and handle the event in QgsCodeEditor::keyPressEvent
|
||||
|
@ -534,7 +534,7 @@ void QgsCodeEditorPython::populateContextMenu( QMenu *menu )
|
||||
);
|
||||
|
||||
pyQgisHelpAction->setEnabled( hasSelectedText() );
|
||||
pyQgisHelpAction->setShortcut( QStringLiteral( "F1" ) );
|
||||
pyQgisHelpAction->setShortcut( QKeySequence::StandardKey::HelpContents );
|
||||
connect( pyQgisHelpAction, &QAction::triggered, this, [text, this] { showApiDocumentation( text ); } );
|
||||
|
||||
menu->addSeparator();
|
||||
|
Loading…
x
Reference in New Issue
Block a user