summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/disassembleragent.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-02-11 14:00:09 +0100
committerEike Ziller <eike.ziller@qt.io>2020-02-12 10:28:31 +0000
commitd43f1662d0b44b3b930989f11604661c377bd67e (patch)
treea0fa3da727994ee53dba9c8eae17b741004515fe /src/plugins/debugger/disassembleragent.cpp
parent42f02fae035b2eda431c0b8c05a3bd5d85f0a280 (diff)
downloadqt-creator-d43f1662d0b44b3b930989f11604661c377bd67e.tar.gz
Make TextEditor setup more flexible
So far it was only possible to combine TextEditorFactory, BaseTextEditor and TextEditorWidget directly. That TextEditorWidget is also directly a QPlainTextEdit made it impossible to "decorate" the text editor widget with something else without a lot of effort. Make it possible to create a text editor factory that returns an arbitrary widget, as long as it can be "cast" to a TextEditorWidget with either qobject_cast or Aggregation::query. That way the TextEditorWidget instance can be attached to the editor widget via Aggregation. Adapt other code that accesses TextEditorWidget from editors accordingly. Introduce a common method how to do that. Change-Id: I72b8721f3a8a8d8281c39af75253e9c80cbe1250 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/debugger/disassembleragent.cpp')
-rw-r--r--src/plugins/debugger/disassembleragent.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/debugger/disassembleragent.cpp b/src/plugins/debugger/disassembleragent.cpp
index 3af906f298..0c41c1475d 100644
--- a/src/plugins/debugger/disassembleragent.cpp
+++ b/src/plugins/debugger/disassembleragent.cpp
@@ -266,7 +266,7 @@ void DisassemblerAgentPrivate::configureMimeType()
Utils::MimeType mtype = Utils::mimeTypeForName(mimeType);
if (mtype.isValid()) {
foreach (IEditor *editor, DocumentModel::editorsForDocument(document))
- if (auto widget = qobject_cast<TextEditorWidget *>(editor->widget()))
+ if (auto widget = TextEditorWidget::fromEditor(editor))
widget->configureGenericHighlighter();
} else {
qWarning("Assembler mimetype '%s' not found.", qPrintable(mimeType));
@@ -314,7 +314,7 @@ void DisassemblerAgent::setContentsToDocument(const DisassemblerLines &contents)
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
&titlePattern);
QTC_ASSERT(editor, return);
- if (auto widget = qobject_cast<TextEditorWidget *>(editor->widget())) {
+ if (auto widget = TextEditorWidget::fromEditor(editor)) {
widget->setReadOnly(true);
widget->setRequestMarkEnabled(true);
}