[Qt-creator] own editor plugin and mimetypes
Florian Schwehn
fschwehn at googlemail.com
Tue Nov 17 19:23:06 CET 2009
Hi.
unfortunaltely i have no awnser to your question. but are you going to
commit your plugin? having en XML-editor within Qt Creator would be a very
nice feature!
Florian
2009/11/17 Liebe Markus (RtP2/TEF72) <Markus.Liebe at de.bosch.com>
> 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
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20091117/3b792407/attachment.html
More information about the Qt-creator-old
mailing list