Designer and custom subclass of Qmenu
-
Hi,
How can we add a custom instance of QMenu (implemented in a Designer plugin) within the QMenuBar of a QMainWindow?
Let me elaborate on this.
I have implemented a custom widget as a subclass of QMenu. The behavior is the same as any QMenu inside a QMenuBar but the menu is pre-filled with several predefined actions. Consider this as a "standard menu" which is included in many applications. Since I do not want to repeat the design and code everywhere, it has become a custom widget.
This custom widget is included in a Designer plugin, along with other custom widgets.
Using Designer, I create a "Main Window" application. The menu bar is here but I cannot drag and drop my QMenu subclass inside the menu bar. In fact, you cannot drop anything in the menu bar. The only thing you can do is use the "Type Here" feature and create all the menus by hand, which is exactly I would like to avoid for my "standard menu".
The weird thing is that the menus you build manually become instances of QMenu. So, dropping an instance of a subclass of QMenu in the menu bar should make sense.
The workaround is to create manually the placeholder for my standard menu using "Type Here" and then I use "promote" on the corresponding QMenu to may subclass. This works. The correct standard menu is created at run time. But this is ugly. My standard menu appears as empty in Designer, it does not work in preview mode, etc. This is why I implemented a Designer plugin.
Is there any solution to use a subclass of QMenu from a Designer plugin?
Thanks
-
hey did you solve your problem.
please help if you or anybody did . because i am working on a similar project and facing similar difficulties -
No, I did not solve it, I live with it...
If fact, I only posted 4 technical questions in Qt Forums, all 4 precise technical questions which seem legitimate like this one, and got zero answer to any of them. Not even a "not possible, sorry" answer. So, you should not expect too much.
-
ok thanks i guess i would have to look for other solutions