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. Open QMenu to particular side
Forum Updated to NodeBB v4.3 + New Features

Open QMenu to particular side

Scheduled Pinned Locked Moved General and Desktop
qmenu
6 Posts 2 Posters 2.3k 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.
  • A Offline
    A Offline
    Anna234
    wrote on last edited by
    #1

    Hi I'm using a QMenu in my QApplication and depending on the position of the QMainWindow the menu items open to the left side or the right side. How can I control to which side the menu items open up when clicking on the menu? Is there a method to control this on the menu? I want that the menu always opens to the left side, never to the right side. Any help is appreciated.

    A 1 Reply Last reply
    0
    • A Anna234

      Hi I'm using a QMenu in my QApplication and depending on the position of the QMainWindow the menu items open to the left side or the right side. How can I control to which side the menu items open up when clicking on the menu? Is there a method to control this on the menu? I want that the menu always opens to the left side, never to the right side. Any help is appreciated.

      A Offline
      A Offline
      Anna234
      wrote on last edited by
      #2

      No one knows how to do this?

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

        Hi,

        For what you want to do you would probably have to implement a custom QMenu in order to modify the popup handling.

        Out of curiosity, why do you want to do that ?

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

        A 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          For what you want to do you would probably have to implement a custom QMenu in order to modify the popup handling.

          Out of curiosity, why do you want to do that ?

          A Offline
          A Offline
          Anna234
          wrote on last edited by
          #4

          @SGaist My app uses a virtual desktop with two windows, and I want the pop up to only open to the side that resides within the window where the menu resides. Currently the QApp spans across windows, so takes up the full virtual desktop, and then the pop up opens to the side where the second window lies. I want the pop up to be kept on the window where it is opened.

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

            It's a bit clearer. To see how you setup your menus, can you show an image of your application ?

            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
            • A Offline
              A Offline
              Anna234
              wrote on last edited by
              #6

              I have found the solution btw, if anyone ever gets the same problem. It was quite easy actually:

              setLayoutDirection( Qt::RightToLeft );

              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