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] QT Designer: Created Menubar in QMainWindow not showing after editing
Forum Updated to NodeBB v4.3 + New Features

[Solved] QT Designer: Created Menubar in QMainWindow not showing after editing

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 5.6k Views 1 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.
  • R Offline
    R Offline
    rvank
    wrote on last edited by
    #1

    Hi All,

    I have a strange problem. I'm trying to design a main window for my python app, but the menu i create does not show when i try the preview function in QT Designer (using QT 4.8.5)
    I am working on OSX 10.9.

    If i make a clean main window and i add a menu title and some items in that menu the menu does not always show up or shows only some of the menu items.
    I seems like if i have ever used that menu name that it will work or not.
    I just created a new main window and a menu called robbie with the items denise, cylla, jack and grace, preview shows the correct menu
    I saved it in the project folder of my app, and preview still shows the correct menu
    I changed the menu items denise into About, cylla into Preferences and grace into Quit.
    When i now do a preview of my form i get the menu with only the item jack. the only item i did not change.

    This is the contents of my saved window layout
    @<?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
    <class>MainWindow</class>
    <widget class="QMainWindow" name="MainWindow">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
    </rect>
    </property>
    <property name="windowTitle">
    <string>MainWindow</string>
    </property>
    <widget class="QWidget" name="centralwidget"/>
    <widget class="QMenuBar" name="menubar">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>22</height>
    </rect>
    </property>
    <widget class="QMenu" name="menuRobbie">
    <property name="title">
    <string>robbie</string>
    </property>
    <addaction name="actionDenise"/>
    <addaction name="actionCylla"/>
    <addaction name="actionJack"/>
    <addaction name="actionGrace"/>
    </widget>
    <addaction name="menuRobbie"/>
    </widget>
    <widget class="QStatusBar" name="statusbar"/>
    <action name="actionDenise">
    <property name="text">
    <string>About</string>
    </property>
    </action>
    <action name="actionCylla">
    <property name="text">
    <string>Preferences</string>
    </property>
    </action>
    <action name="actionJack">
    <property name="text">
    <string>jack</string>
    </property>
    </action>
    <action name="actionGrace">
    <property name="text">
    <string>Quit</string>
    </property>
    </action>
    </widget>
    <resources/>
    <connections/>
    </ui>@

    I created a new main window and created the same menu with the same items, all showed up correctly in preview, then i deleted the menu and created a new one called SyncSeries with the items About, Preferences and Quit.
    When i now do a preview the whole menu does not show up.

    Below is the contents of the saved window layout
    @<?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
    <class>MainWindow</class>
    <widget class="QMainWindow" name="MainWindow">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
    </rect>
    </property>
    <property name="windowTitle">
    <string>MainWindow</string>
    </property>
    <widget class="QWidget" name="centralwidget"/>
    <widget class="QMenuBar" name="menubar">
    <property name="geometry">
    <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>22</height>
    </rect>
    </property>
    <widget class="QMenu" name="menuSyncSeries">
    <property name="title">
    <string>SyncSeries</string>
    </property>
    <addaction name="actionAbout"/>
    <addaction name="actionPreferences"/>
    <addaction name="actionQuit"/>
    </widget>
    <addaction name="menuSyncSeries"/>
    </widget>
    <widget class="QStatusBar" name="statusbar"/>
    <action name="actionDenise">
    <property name="text">
    <string>Denise</string>
    </property>
    </action>
    <action name="actionCylla">
    <property name="text">
    <string>Cylla</string>
    </property>
    </action>
    <action name="actionGrace">
    <property name="text">
    <string>Grace</string>
    </property>
    </action>
    <action name="actionJack">
    <property name="text">
    <string>Jack</string>
    </property>
    </action>
    <action name="actionAbout">
    <property name="text">
    <string>About</string>
    </property>
    </action>
    <action name="actionPreferences">
    <property name="text">
    <string>Preferences</string>
    </property>
    </action>
    <action name="actionQuit">
    <property name="text">
    <string>Quit</string>
    </property>
    </action>
    </widget>
    <resources/>
    <connections/>
    </ui>@

    I also tried to do the same changes without saving the form, and without saving the problem is here.
    I tried to change the first item to a item name i used before and that did not work, as soon as i changed it back to the original name the menu worked correctly. When i changed the first item to something i did not use before the menu worked correctly. I tried different spellings of 'Preferences' to see if it was case sensitive, i tried 'Preference' and 'preferences' both did not work.

    I hope that there is somebody here that can tell me what is happening and how to prevent/correct this.

    Kind regards.
    Rob.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      About, Preferences and Quit are special cases in OS X and are found under the "ApplicationName" menu

      Qt handles that for you. Don't try to move them somewhere else, you'll end up breaking the OS X user guide lines which is something you should not do

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rvank
        wrote on last edited by
        #3

        Thx, at least now i know im not cray :-)

        How can i get the ApplicationMenu into my design in QT Designer, or is that something i have to handle in the code of my python app?

        Rob.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Nop, you're not :)

          AFAIK you can't (I may be wrong though)

          The general idea is that you design your application "normally" and Qt handles for you the correct placing of these special menu entries. You can have a look at QMenu and QMenuBar's documentation for more details about that

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rvank
            wrote on last edited by
            #5

            Thx, i'm gone dive deeper into the QMenu(Bar)

            Rob.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You're welcome !

              In between, if this answers your question, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

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