Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] How to edit mainwindow.ui to add submenus
Forum Updated to NodeBB v4.3 + New Features

[Solved] How to edit mainwindow.ui to add submenus

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    te777
    wrote on last edited by te777
    #1

    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>
    
    K 1 Reply Last reply
    0
    • T te777

      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>
      
      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @te777

      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.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      2
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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. ?

        1 Reply Last reply
        1
        • T Offline
          T Offline
          te777
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved