diff --git a/src/WizEditorToolBar.cpp b/src/WizEditorToolBar.cpp index 1c7e5903..1a80bba6 100755 --- a/src/WizEditorToolBar.cpp +++ b/src/WizEditorToolBar.cpp @@ -19,7 +19,7 @@ #include #include #include - +#include #include #include "share/WizMisc.h" @@ -1968,6 +1968,13 @@ WizEditorToolBar::WizEditorToolBar(WizExplorerApp& app, QWidget *parent) setToolbarType(TOOLBARTYPE_NORMAL); //setToolbarType(TOOLBARTYPE_HIGHLIGHTER); //setToolbarType(TOOLBARTYPE_OUTLINE); + + new QShortcut(QKeySequence("Ctrl+1"), this, SLOT(on_comboParagraph_shortcutActivated())); + new QShortcut(QKeySequence("Ctrl+2"), this, SLOT(on_comboParagraph_shortcutActivated())); + new QShortcut(QKeySequence("Ctrl+3"), this, SLOT(on_comboParagraph_shortcutActivated())); + new QShortcut(QKeySequence("Ctrl+4"), this, SLOT(on_comboParagraph_shortcutActivated())); + new QShortcut(QKeySequence("Ctrl+5"), this, SLOT(on_comboParagraph_shortcutActivated())); + new QShortcut(QKeySequence("Ctrl+6"), this, SLOT(on_comboParagraph_shortcutActivated())); } void WizEditorToolBar::switchToNormalMode() { @@ -3301,6 +3308,14 @@ void WizEditorToolBar::on_editor_justifyRight_triggered() m_editor->editorCommandExecuteJustifyRight(); } +void WizEditorToolBar::on_comboParagraph_shortcutActivated() +{ + QShortcut* shortcut = qobject_cast(sender()); + QKeySequence seq = shortcut->key(); + QString key_string = seq.toString(); + int index = 56 - (int)key_string.back().toLatin1(); + on_comboParagraph_indexChanged(index); +} void WizEditorToolBar::on_comboParagraph_indexChanged(int index) { diff --git a/src/WizEditorToolBar.h b/src/WizEditorToolBar.h index 489f6636..b65ece68 100755 --- a/src/WizEditorToolBar.h +++ b/src/WizEditorToolBar.h @@ -179,6 +179,7 @@ protected Q_SLOTS: void on_editor_justifyRight_triggered(); + void on_comboParagraph_shortcutActivated(); void on_comboParagraph_indexChanged(int index); void on_comboFontFamily_indexChanged(int index); void on_comboFontSize_indexChanged(const QString& strSize);