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. MacOs, How to implement Preference menu to open custom dialog?
Forum Updated to NodeBB v4.3 + New Features

MacOs, How to implement Preference menu to open custom dialog?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 539 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.
  • J Offline
    J Offline
    JohnGa
    wrote on last edited by JohnGa
    #1

    Hello,
    I have an openPreferences action defined in the form. Within the form, the openPreference action is connected to the openPreferencesDialog slot. This works perfectly on all platforms, except on Mac.

    I also have other menus with "QuitRole", and "AboutRole". These work perfectly, even on Mac.

    OPTION 1:
    As per documentation, the openPreferences action has a menuRole of "PreferencesRole". On macOs, it renders "Preferences..." under the application menu. However, the "Preferences..." menu always invokes some other slot in the application (and not the openPreferencesDialog slot).

    OPTION 2:
    When I set, "menuBar->setNativeMenuBar(false)", the menuBar gets painted within the application window. There is a "Preferences" menu in the application window, and "Preferences..." menu in the Mac application menubar at the top. Both the "Preferences" menus correctly open the preferences dialog. But, this makes for very bad user experience.

    QUESTION
    My understanding is that Qt does preprocessing and moves the menus around for macOs. What am I doing wrong in OPTION 1? How can I get that to work?

    Thanks.

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

      Hi,

      Please show the code you use to build your menus.

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

      J 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Please show the code you use to build your menus.

        J Offline
        J Offline
        JohnGa
        wrote on last edited by
        #3

        @SGaist I used this link where you had also posted info.

        https://forum.qt.io/topic/57852/solved-menu-bar-remains-stubbornly-invisible-on-mac-os-x-yosemite

        The key was to set the parent of the menuBar to null. That resolved the problem.

        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