Unsolved [Solved] How to edit mainwindow.ui to add submenus
-
I have an app that has too many items in one of the menu choices. I need to create 2 submenus from that menu choice and split action items between the 2 submenus. I'm trying to edit the mainwindow.ui in Notepad but I don't know the syntax needed to create submenus, then to add the action items to the submenus. I want to move all the Powerball items to a Powerball submenu, and all the Mega Millions items to a Mega Millions submenu. Here's what I have. Any replies would be welcome.
I hope the subject matter of the application doesn't turn off possible repliers. It's a free application available on the web that I've developed in my spare time. It is not a commercial application.
<widget class="QMenu" name="menuComplete_Analysis"> <property name="title"> <string>Complete Analysis</string> </property> <addmenu name="menuPowerball"/> <addaction name="actionPowerball_numbers"/> <addaction name="actionPowerball_power_ball"/> <addaction name="actionPowerball_Numbers_Ranks"/> <addaction name="actionPowerball_Numbers_Ranks_Average"/> <addaction name="separator"/> <addaction name="actionPowerball_Matching_Combinations"/> <addaction name="actionPowerball_Enter_numbers_to_check_matches"/> <addaction name="actionPowerball_Check_Matches_History"/> <addaction name="separator"/> <addaction name="actionPowerball_Find_Best_Combinations_2"/> <addaction name="actionPowerball_Find_Best_Combinations_3"/> <addaction name="actionPowerball_FInd_Best_Combinations_3"/> <addaction name="actionPowerball_Find_Best_Combinations_4"/> <addaction name="actionPowerball_Combinations_All"/> <addaction name="separator"/> <addaction name="actionPowerball_Random_Numbers_Analysis"/> <addaction name="actionPowerball_Random_Numbers_Analysis_2"/> <addmenu name="menuMega_Millions"/> <addaction name="actionMega_Millions_numbers"/> <addaction name="actionMega_Millions_mega_ball"/> <addaction name="actionMega_Millions_Numbers_Ranks"/> <addaction name="actionMega_Millions_Numbers_Rank_Average"/> <addaction name="separator"/> <addaction name="actionMega_Millions_Matching_Combinations"/> <addaction name="actionMega_Millions_Enter_numbers_to_check_matches"/> <addaction name="actionMega_Millions_Check_Matches_History"/> <addaction name="separator"/> <addaction name="actionMega_Millions_Find_Best_Combinations_2"/> <addaction name="actionMega_Millions_Find_Best_Combinstions_3"/> <addaction name="actionMega_Millions_Find_Best_Combinations_3"/> <addaction name="actionMega_Millions_Find_Best_Combinations_4"/> <addaction name="actionMega_Millions_Combinations_All"/> <addaction name="separator"/> <addaction name="actionMega_Millions_Random_Numbers_Analysis"/> <addaction name="actionMega_Millions_Random_Numbers_Analysis_2"/> </widget>
-
You can use designer to add a sub menu once. Afterwards you can check out the actual changes and see, if you can multiply for your purpose.
The snippet below has been obtained through adding action to the main menu.
In the main entry I have added two actions while the second has been extended as submenu in designer.<action name="actionAdded_action"> <property name="text"> <string>added action</string> </property> </action> <action name="actionAdded_action_sub_menu"> <property name="text"> <string>added action sub menu</string> </property> </action>
I suggest doing it youself in a small example. Makes it probably easier for your to understand.
-
Hi
Just to be sure. You can drag and drop between menus in Designer.
I assume you want to edit the UI
files as there are so many that
drag&drop is tedious or wont let u move them to where you want. ? -
Thanks. I was hoping to not have to create all new slots by editing the mainwindow.ui. But I used the designer to create the submenus and new slots. I then had to copy all the code for the old slots to the new slots. Thanks for the reply. I appreciate it.