diff options
author | Eike Ziller <eike.ziller@qt.io> | 2017-05-09 12:19:11 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2017-05-18 08:24:26 +0000 |
commit | ee722a047cfd4bee213343087519a0380f5227e8 (patch) | |
tree | 3a717ac05c5a0a009b3b659b7597754bbb6757e4 /src/plugins/diffeditor/diffeditorfactory.cpp | |
parent | fd7edcb8263059d828873e5ed675fa2e43dfdf01 (diff) | |
download | qt-creator-ee722a047cfd4bee213343087519a0380f5227e8.tar.gz |
DiffEditor: Fix editor actions
The text editor widgets all need a TextEditorActionHandler that takes
care of the editor actions for them.
Each text editor needs its own context, so the editor with focus
receives the actions. This does not happen automatically for these text
editors, since the diff editor manages these itself.
Task-number: QTCREATORBUG-9445
Change-Id: Ib42f095ec23550e401e8ee9b36f3f49517a22877
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/diffeditor/diffeditorfactory.cpp')
-rw-r--r-- | src/plugins/diffeditor/diffeditorfactory.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/plugins/diffeditor/diffeditorfactory.cpp b/src/plugins/diffeditor/diffeditorfactory.cpp index 714b0d25ca..9944bec558 100644 --- a/src/plugins/diffeditor/diffeditorfactory.cpp +++ b/src/plugins/diffeditor/diffeditorfactory.cpp @@ -29,6 +29,8 @@ #include "diffeditorfactory.h" #include "sidebysidediffeditorwidget.h" +#include "texteditor/texteditoractionhandler.h" + #include <QCoreApplication> namespace DiffEditor { @@ -40,6 +42,26 @@ DiffEditorFactory::DiffEditorFactory(QObject *parent) setId(Constants::DIFF_EDITOR_ID); setDisplayName(QCoreApplication::translate("DiffEditorFactory", Constants::DIFF_EDITOR_DISPLAY_NAME)); addMimeType(Constants::DIFF_EDITOR_MIMETYPE); + auto descriptionHandler = new TextEditor::TextEditorActionHandler( + this, id(), Constants::C_DIFF_EDITOR_DESCRIPTION); + descriptionHandler->setTextEditorWidgetResolver([](Core::IEditor *e) { + return static_cast<DiffEditor *>(e)->descriptionWidget(); + }); + auto unifiedHandler = new TextEditor::TextEditorActionHandler( + this, id(), Constants::UNIFIED_VIEW_ID); + unifiedHandler->setTextEditorWidgetResolver([](Core::IEditor *e) { + return static_cast<DiffEditor *>(e)->unifiedEditorWidget(); + }); + auto leftHandler = new TextEditor::TextEditorActionHandler( + this, id(), Core::Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(1)); + leftHandler->setTextEditorWidgetResolver([](Core::IEditor *e) { + return static_cast<DiffEditor *>(e)->leftEditorWidget(); + }); + auto rightHandler = new TextEditor::TextEditorActionHandler( + this, id(), Core::Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(2)); + rightHandler->setTextEditorWidgetResolver([](Core::IEditor *e) { + return static_cast<DiffEditor *>(e)->rightEditorWidget(); + }); } Core::IEditor *DiffEditorFactory::createEditor() |