[Qt-creator] Way to make some custome operations before file save in subclasses of TextEditor::BaseTextEditor

Denis Kormalev kormalev.denis at gmail.com
Wed Nov 3 22:41:16 CET 2010


Hello all,

I'm developing plugin to show xml as tree (you can look at it here: 
http://gitorious.org/qt-creator-xml-tree-plugin). For now I've stopped at 
design where I have two tabs: one for tree and another for xml source. I'm 
showing xml source in PlainTextEditor subclass and so I use BaseTextEditable 
subclass too instead of custom Core::IEditor subclassing. I need to perform 
some work before saving. For example, I need to update PlainTextEditor 
contents before saving if I'm in tree tab (I'm updating contents of tabs only 
at tab switching for better performance), but I can't find way to put my code 
after ctrl-s was clicked and before data was pushed to file. 
I think that someone who will need to write some editor based on 
PlainTextEditor will want such functionality too. For example if he wants to 
add some data to file or maybe clean it from unneeded spaces or somewhat else.
What are you thinking about adding virtual method named like beforeSave() to 
BaseTextEditor?

Regards,
Denis Kormalev.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20101103/e48c7e3f/attachment.html 


More information about the Qt-creator-old mailing list