[Qt-creator] own editor plugin and mimetypes
Liebe Markus (RtP2/TEF72)
Markus.Liebe at de.bosch.com
Tue Nov 17 09:53:35 CET 2009
Hello there,
I am developing an own editor plugin for QtCreator (modeditor). It is supposed to provide an editor for *.xml files.
I created a new mimetype description:
-----------application-xml-mimetype.xml------------------
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/xml">
<sub-class-of type="text/plain"/>
<comment>XML File</comment>
<glob pattern="*.xml"/>
</mime-type>
</mime-info>
---------------------------------------------------------
In my plugins ::initialize() function I add that mimetype:
---------------------------------------------------------
[...]
Core::MimeDatabase* mdb = new m_core->mimeDatabase();
If(!mdb->addMimeTypes(":/modeditor/application-xml-mimetype.xml",error))
return false;
addAutoReleasedObject(new XmlEditorFactory(this));
[...]
---------------------------------------------------------
The modeditor plugin gets loaeded properly. Help->About->plugins does not show any errors.
Problem is now that xml files are still opened only in the plain-text-editor.
I had a look into the existing editor plugins and found out that there is indeed already a mimetype for xml files that is used by the texteditor plugin.
I think that now that there are two mimetypes for xml and two possible editorplugins qtcreator chooses the texteditor over the modeditor.
To check that I bound the modeditor plugin to the mimetype text/x-java and the glob *.java instead. As a result of this my modeditor worked as expected and qtcreator used it to display *.java files.
But I am still not able to make modeditor display the xml files using the mimetype description from above. Or more precisely to make qtcreator know that it should use the new modeditor plugin to display xml files instead of the texteditor plugin.
Do you have any hints on what the problem could be?
Thanks!
Markus
More information about the Qt-creator-old
mailing list