QmlJsEditor: Delay the call of registerIconOverlayForMimeType

Calling FileIconProvider::registerIconOverlayForMimeType during plugin
construction caused the warning:

Accessing MimeDatabase for application/x-qt.ui+qml before plugins are
initialized

Better register it in extensionsInitialized.

Amends: 613a9a13c8

Change-Id: I08ebcad461019464dec04954aa8b436d96f503cc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2021-12-14 10:45:52 +01:00
parent 442ce3e019
commit 2000491108

View File

@@ -211,8 +211,6 @@ QmlJSEditorPluginPrivate::QmlJSEditorPluginPrivate()
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QML, "qml"); FileIconProvider::registerIconOverlayForSuffix(ProjectExplorer::Constants::FILEOVERLAY_QML, "qml");
FileIconProvider::registerIconOverlayForMimeType(ProjectExplorer::Constants::FILEOVERLAY_UI,
"application/x-qt.ui+qml");
connect(EditorManager::instance(), &EditorManager::currentEditorChanged, connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
this, &QmlJSEditorPluginPrivate::currentEditorChanged); this, &QmlJSEditorPluginPrivate::currentEditorChanged);
@@ -223,6 +221,9 @@ QmlJSEditorPluginPrivate::QmlJSEditorPluginPrivate()
void QmlJSEditorPlugin::extensionsInitialized() void QmlJSEditorPlugin::extensionsInitialized()
{ {
FileIconProvider::registerIconOverlayForMimeType(ProjectExplorer::Constants::FILEOVERLAY_UI,
"application/x-qt.ui+qml");
TaskHub::addCategory(Constants::TASK_CATEGORY_QML, tr("QML")); TaskHub::addCategory(Constants::TASK_CATEGORY_QML, tr("QML"));
TaskHub::addCategory(Constants::TASK_CATEGORY_QML_ANALYSIS, tr("QML Analysis"), false); TaskHub::addCategory(Constants::TASK_CATEGORY_QML_ANALYSIS, tr("QML Analysis"), false);
} }