[Qt-creator] Help with plugins

Jochen Becher jochen_becher at gmx.de
Mon Oct 28 19:30:21 CET 2013


Hi,

I am working on a complex plug-in which introduces a new mode for files
of a certain mime type. I have some questions about implementing a few
features and I hope you can give me some links to source code files
where I can copy the behavior:

1. When I open document of my mime type the file is usually opened in
Edit mode. Currently I show a simple "switch to the correct mode" label
because the file cannot be edited here (it is an xml format that makes
no sense to edit it manually). In Edit mode I can save the file (when it
has been changed used the new mode) or select "Save All" and some other
menu items. As soon as i switch to the new mode "Save" and "Save All"
are disabled. How do I have to set the right context to enable these
items in the new mode as well?

2. What is the preferred way to switch to a new mode after opening the
document? Directly switch to the mode from the document's open() method
using the ModeManager does not work. I tried to make it asynchronous
using a signal from the document's open() method with
Qt::QuededConnection. This works better but it behaves in an unexpected
way. Isn't there a signal like "FileWasOpened" where I can connect to?

3. How can I save the layout of the mode's main window or other dialogs?
Is there an official way to save such settings (properties of
MiniSplitter etc)?

Regards, Jochen





More information about the Qt-creator mailing list