diff options
author | Aleksei German <aleksei.german@qt.io> | 2021-09-10 18:06:26 +0200 |
---|---|---|
committer | Aleksei German <aleksei.german@qt.io> | 2021-10-12 08:09:19 +0000 |
commit | 3ccf269f81eb7d26af1962915026ae9ce4b6d5f8 (patch) | |
tree | d995aa4d8d53976d735828d618619b6a4aea582c /src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp | |
parent | 786dbcb9e86104be12ceded01188f9b4095e47be (diff) | |
download | qt-creator-3ccf269f81eb7d26af1962915026ae9ce4b6d5f8.tar.gz |
QmlDesigner: Fix for Binding Editor
- Makes Binding Editor modal
- Fixes Binding Editors hotkeys and actions
- Adds Target item, property and expected type into title
Task-numbers: QDS-2819, QDS-4878
Change-Id: Ib5c5f73e6552f58828776043f9b793a24c48a1f8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp')
-rw-r--r-- | src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp b/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp index 6cd810df37..5b9c54b4d4 100644 --- a/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/bindingeditor/bindingeditorwidget.cpp @@ -35,6 +35,10 @@ #include <qmljseditor/qmljseditordocument.h> #include <qmljseditor/qmljssemantichighlighter.h> #include <qmljstools/qmljsindenter.h> +#include <qmljstools/qmljstoolsconstants.h> + +#include <projectexplorer/projectexplorerconstants.h> +#include <utils/fancylineedit.h> #include <QAction> @@ -43,17 +47,19 @@ namespace QmlDesigner { BindingEditorWidget::BindingEditorWidget() : m_context(new Core::IContext(this)) { + Core::Context context(BINDINGEDITOR_CONTEXT_ID, + ProjectExplorer::Constants::QMLJS_LANGUAGE_ID); + m_context->setWidget(this); + m_context->setContext(context); Core::ICore::addContextObject(m_context); - const Core::Context context(BINDINGEDITOR_CONTEXT_ID); - /* * We have to register our own active auto completion shortcut, because the original short cut will * use the cursor position of the original editor in the editor manager. */ - m_completionAction = new QAction(tr("Trigger Completion"), this); + Core::Command *command = Core::ActionManager::registerAction( m_completionAction, TextEditor::Constants::COMPLETE_THIS, context); command->setDefaultKeySequence(QKeySequence( @@ -84,11 +90,9 @@ bool BindingEditorWidget::event(QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); - if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) { + if ((keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) && !keyEvent->modifiers()) { emit returnKeyClicked(); return true; - } else { - return QmlJSEditor::QmlJSEditorWidget::event(event); } } return QmlJSEditor::QmlJSEditorWidget::event(event); @@ -133,8 +137,12 @@ void BindingDocument::triggerPendingUpdates() BindingEditorFactory::BindingEditorFactory() { setId(BINDINGEDITOR_CONTEXT_ID); - setDisplayName(QCoreApplication::translate("OpenWith::Editors", QmlDesigner::BINDINGEDITOR_CONTEXT_ID)); + setDisplayName(QCoreApplication::translate("OpenWith::Editors", BINDINGEDITOR_CONTEXT_ID)); setEditorActionHandlers(0); + addMimeType(BINDINGEDITOR_CONTEXT_ID); + addMimeType(QmlJSTools::Constants::QML_MIMETYPE); + addMimeType(QmlJSTools::Constants::QMLTYPES_MIMETYPE); + addMimeType(QmlJSTools::Constants::JS_MIMETYPE); setDocumentCreator([]() { return new BindingDocument; }); setEditorWidgetCreator([]() { return new BindingEditorWidget; }); |