diff options
author | hjk <hjk@qt.io> | 2020-02-04 18:16:57 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-02-05 11:41:29 +0000 |
commit | d7ae3b79f89f91f6b15f807b5c894da7e06c3013 (patch) | |
tree | ebbd5ded1ddd1fa035e99ebe98b384e676cfebb4 /src/plugins/scxmleditor | |
parent | ccc2a347a75c3fd06d8f2028a17a3477c40e0a13 (diff) |
Core: Make IEditorFactory::createEditor use a function object
Also, replace or remove unneeded Q_OBJECTs, and make base
setters and adders protected.
Change-Id: I212257ef53984d8852dc8c478537199fc9483486
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/scxmleditor')
-rw-r--r-- | src/plugins/scxmleditor/scxmleditorfactory.cpp | 19 | ||||
-rw-r--r-- | src/plugins/scxmleditor/scxmleditorfactory.h | 6 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/plugins/scxmleditor/scxmleditorfactory.cpp b/src/plugins/scxmleditor/scxmleditorfactory.cpp index 013ce959e7..a7120e71df 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.cpp +++ b/src/plugins/scxmleditor/scxmleditorfactory.cpp @@ -46,15 +46,14 @@ ScxmlEditorFactory::ScxmlEditorFactory(QObject *parent) addMimeType(ProjectExplorer::Constants::SCXML_MIMETYPE); Core::FileIconProvider::registerIconOverlayForSuffix(":/projectexplorer/images/fileoverlay_scxml.png", "scxml"); -} -Core::IEditor *ScxmlEditorFactory::createEditor() -{ - if (!m_editorData) { - m_editorData = new ScxmlEditorData(this); - QGuiApplication::setOverrideCursor(Qt::WaitCursor); - m_editorData->fullInit(); - QGuiApplication::restoreOverrideCursor(); - } - return m_editorData->createEditor(); + setEditorCreator([this] { + if (!m_editorData) { + m_editorData = new ScxmlEditorData(this); + QGuiApplication::setOverrideCursor(Qt::WaitCursor); + m_editorData->fullInit(); + QGuiApplication::restoreOverrideCursor(); + } + return m_editorData->createEditor(); + }); } diff --git a/src/plugins/scxmleditor/scxmleditorfactory.h b/src/plugins/scxmleditor/scxmleditorfactory.h index 8732d94acc..42135ec64b 100644 --- a/src/plugins/scxmleditor/scxmleditorfactory.h +++ b/src/plugins/scxmleditor/scxmleditorfactory.h @@ -32,15 +32,11 @@ namespace Internal { class ScxmlEditorData; -class ScxmlEditorFactory : public Core::IEditorFactory +class ScxmlEditorFactory final : public Core::IEditorFactory { - Q_OBJECT - public: explicit ScxmlEditorFactory(QObject *parent); - Core::IEditor *createEditor() override; - private: ScxmlEditorData* m_editorData = nullptr; }; |