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. Margins for QMenu secondary menus
Forum Updated to NodeBB v4.3 + New Features

Margins for QMenu secondary menus

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 240 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.
  • N Offline
    N Offline
    Nan Feng
    wrote on last edited by
    #1

    Hi Qt guys from the community, hello! I'm using Qt, but I'm having some issues. QMenu adds a secondary menu, but the display position of the secondary menu may be to the left or right of the primary menu, whether it is left or right, the secondary menu is always pressed and part of the menu, is there any way to adjust? If the inheritance QMenu overrides a class, which methods can control the margins

    Pl45m4P 1 Reply Last reply
    0
    • N Nan Feng

      Hi Qt guys from the community, hello! I'm using Qt, but I'm having some issues. QMenu adds a secondary menu, but the display position of the secondary menu may be to the left or right of the primary menu, whether it is left or right, the secondary menu is always pressed and part of the menu, is there any way to adjust? If the inheritance QMenu overrides a class, which methods can control the margins

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @Nan-Feng
      Hi,
      you can control where a QMenu pops up with
      QMenu::exec(position)

      https://doc.qt.io/qt-6/qmenu.html#exec-1

      Or what exactly do you expect?


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      N 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @Nan-Feng
        Hi,
        you can control where a QMenu pops up with
        QMenu::exec(position)

        https://doc.qt.io/qt-6/qmenu.html#exec-1

        Or what exactly do you expect?

        N Offline
        N Offline
        Nan Feng
        wrote on last edited by
        #3

        @Pl45m4 Hi, first of all thank you for taking your time to answer my doubts! The secondary menu pointed out above is a MainMenu added using MainMenu->addMenu method as a first-level menu, QMenu::exec(position) does not seem to control the pop-up position of the secondary menu, and how to get position? The scenario of this menu occurs on the click event of the taskbar tray icon, and the menu is displayed only when the taskbar tray icon is clicked. But how do you get the click position of the tray icon?

        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