QmlJSEditor: add shortcut for Qt Quick Helper (ctrl+alt+space)

This shortcut forces the Qt Quick Helper to be shown if
available. The action is also registered in the context menu
so it is discoverable.


Reviewed-by: Christian Kamm
This commit is contained in:
Thomas Hartmann
2010-08-04 13:50:15 +02:00
parent 70f605065f
commit b193b3598f
5 changed files with 27 additions and 2 deletions

View File

@@ -155,6 +155,12 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
connect(followSymbolUnderCursorAction, SIGNAL(triggered()), this, SLOT(followSymbolUnderCursor()));
contextMenu->addAction(cmd);
QAction *showQuickToolbar = new QAction(tr("Show Qt Quick helper"), this);
cmd = am->registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space));
connect(showQuickToolbar, SIGNAL(triggered()), this, SLOT(showContextPane()));
contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd);
@@ -242,6 +248,15 @@ void QmlJSEditorPlugin::followSymbolUnderCursor()
editor->followSymbolUnderCursor();
}
void QmlJSEditorPlugin::showContextPane()
{
Core::EditorManager *em = Core::EditorManager::instance();
if (QmlJSTextEditor *editor = qobject_cast<QmlJSTextEditor*>(em->currentEditor()->widget()))
editor->showContextPane();
}
Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, Core::ActionManager *am,
Core::Context &context, const QString &name,
Core::ActionContainer *c1, const QString &keySequence)