Hello,

I am trying to develop an application on Qt Creator plugin Framework. I removed all the plugins except the coreplugin. Actually I want to implement a diagram editor which uses a custom xml format as the file format. I found a document "Writing-Qt-Creator-Plugins.pdf" and took it as a reference.

So far I implemented all the interfaces(factory, editor, file,widget...). When I run Qt Creator my plugin is loaded succesfully(I can see it in plugins list) But the problem is I cannot load my specific file format(.mdv). I always get "Cannot open file..." error when I attempt.

I created mimetypes.xml document:

Qt Code:
  1. <?xml version="1.0"?>
  2. <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  3. <mime-type type="application/d-editor">
  4. <sub-class-of type="application/xml"/>
  5. <comment>Diagram File</comment>
  6. <glob pattern="*.mdv"/>
  7. </mime-type>
  8. </mime-info>
To copy to clipboard, switch view to plain text mode 

loaded it:
Qt Code:
  1. QString mimpath=":/diagramEditor.mimetypes.xml";
  2. mdb->addMimeTypes((const QString&)mimpath, &errMs);
To copy to clipboard, switch view to plain text mode 


I defined constants:
Qt Code:
  1. const char * const C_DIAGRAMEDITOR_MIMETYPE = "application/d-editor";
  2. const char * const C_DIAGRAMEDITOR = "Diagram File";
To copy to clipboard, switch view to plain text mode 

and implemented IFile::mimeType(), IEditor::kind() and IEditorFactory::mimeTypes().

Perhaps these may give some clue:
in mimedatabase.cpp:
*findByFile(QFileInfo&) method is returning false....
*m_typeMimeTypeMap.contains(it.key()) always return false. I can debug that those guys contain "application/d-editor" and "application/xml"
*
Qt Code:
  1. Core::MimeType typ = mdb->findByType(QString(DiagramEditorConstants::Constants::C_DIAGRAMEDITOR_MIMETYPE));
  2. qDebug("File Type for application/d-editor = %s", qPrintable(typ.type()));
To copy to clipboard, switch view to plain text mode 
returns:
File Type for application/d-editor = application/d-editor

but
Qt Code:
  1. Core::MimeType type1 = mdb->findByFile( QFileInfo("D:/qtcreator-truncated-build-desktop/YeniDiagram.mdv") );
  2. qDebug("File Type for sample.mdv = %s", qPrintable(type1.type()));
To copy to clipboard, switch view to plain text mode 
returns:
File Type for sample.mdv =

For 3 days I am trying to figure out what is going on; but i am stuck... Any idea, what may be the problem?

Thanks in advance...
Yigit