mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 10:20:17 -06:00
Align Mac shortcut in Scintilla to standard and Qt for Alt+Backspace
In Mac the standard shortcut for deleting word to the left is Alt+Backspace so we set this key sequence in Scintilla editors as alternate for Mac. Reference: http://doc.qt.io/qt-5/qkeysequence.html Section Standard Shortcuts: DeleteStartOfWord is Alt+Backspace in macOS column. See issue #815
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
#include "Qsci/qscilexer.h"
|
||||
#include "Qsci/qsciprinter.h"
|
||||
#ifdef Q_OS_MACX
|
||||
#include <Qsci/qscicommandset.h>
|
||||
#include <Qsci/qscicommand.h>
|
||||
#endif
|
||||
|
||||
#include <QFile>
|
||||
#include <QDropEvent>
|
||||
@@ -16,7 +20,6 @@
|
||||
#include <QPrintPreviewDialog>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
ExtendedScintilla::ExtendedScintilla(QWidget* parent) :
|
||||
QsciScintilla(parent),
|
||||
findReplaceDialog(new FindReplaceDialog(this))
|
||||
@@ -58,6 +61,13 @@ ExtendedScintilla::ExtendedScintilla(QWidget* parent) :
|
||||
QShortcut* shortcutFindReplace = new QShortcut(QKeySequence(tr("Ctrl+H")), this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||
connect(shortcutFindReplace, SIGNAL(activated()), this, SLOT(openFindReplaceDialog()));
|
||||
|
||||
#ifdef Q_OS_MACX
|
||||
// Alt+Backspace on Mac is expected to delete one word to the left,
|
||||
// instead of undoing (default Scintilla binding).
|
||||
QsciCommand * command = standardCommands()->find(QsciCommand::DeleteWordLeft);
|
||||
command->setAlternateKey(Qt::AltModifier+Qt::Key_Backspace);
|
||||
#endif
|
||||
|
||||
QShortcut* shortcutPrint = new QShortcut(QKeySequence(tr("Ctrl+P")), this, nullptr, nullptr, Qt::WidgetShortcut);
|
||||
connect(shortcutPrint, &QShortcut::activated, this, &ExtendedScintilla::openPrintDialog);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user