[Qt-creator] Is it possible to run some commands or scripts on saving the documents?

Hualet Wang mr.asianwang at gmail.com
Wed Sep 9 16:00:48 CEST 2015


Hi Lorenz,

I occasionally found below lines in source code of todo plugin,
> 
>     CppTools::CppModelManager *modelManager =CppTools::CppModelManager::instance();
> 
>     connect(modelManager, &CppTools::CppModelManager::documentUpdated,
>             this, &CppTodoItemsScanner::documentUpdated, Qt::DirectConnection);

I’m pretty excited about that finding, maybe you can use the APIs in that snippet to run
Beautifier on the document every time the document get updated?

> 在 2015年8月28日,下午5:00,Lorenz Haas <lykurg at gmail.com> 写道:
> 
> Hi Hualet,
> 
> I have that on my to do list. Unfortunately this requires some more
> changes to the (global) save mechanism. So, I am sorry, it's not
> possible right now with the Beautifier Plug-in.
> 
> The last days I got aware of the "close Qt Creator hook" where plugins
> can interrupt and stop the close event. I was thinking of a similar hook
> for saving a file. But it's in a early brainstorming stage and I first
> have to ask the core developer if that would be principally okay? Is it? :)
> 
> Best,
> Lorenz
> 
> 
> 
> Am 28.08.2015 um 09:52 schrieb Hualet Wang:
>> I found the useful beautifier plugin yesterday, but what I want is to
>> run astyle every time I save the document. so, any ideas?
>> 
>> -- 
>> -- Hualet
>> 
>> 
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>> 




More information about the Qt-creator mailing list