Hello all, when I make plugins I can use function am->actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); to add my menu entry.
But can I delete or hide existing menu entry? (For Example "File->Save all")
Hello all, when I make plugins I can use function am->actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); to add my menu entry.
But can I delete or hide existing menu entry? (For Example "File->Save all")
Query the action manager for the command you want and hide or disable its QAction. But why would you want to do that?
I am making plugin that would check code style. And as programmers sometimes are too lazy to use such tool so I motivate them in doing so by not allowing them to save code that has bad style.
Thanks for the answer.
Are you sure this is the right approach? Usually such checks would be implemented when the code is committed to a shared repository. You could run your plugin automatically when a file is saved or you could show a dialog box asking the user whether he wants the code checked but disabling the ability to save the file completely can backfire in many situations. Besides, disabling a menu entry will not prevent the user from saving the file, e.g. if he closes the file, he'll be asked whether he wants to save it or not, how are you going to prevent that?
It is implemented in repository. I need to make it offline. I actually didn't knew that you can run your plugin automatically when a file is saved. Is it just a guess or do you really know that it is possible? Thanks in advance.
That's a bad idea, if you ask me. Forcing developers to clean the code before each and every compilation is a real productivity killer.
I don't see why not, after all, it's all Qt/C++ code, you can implement whatever you like.I actually didn't knew that you can run your plugin automatically when a file is saved. Is it just a guess or do you really know that it is possible? Thanks in advance.
Bookmarks