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. QMenu appears under fullscreen MainWindow on Windows (works on Ubuntu)
Forum Updated to NodeBB v4.3 + New Features

QMenu appears under fullscreen MainWindow on Windows (works on Ubuntu)

Scheduled Pinned Locked Moved Unsolved General and Desktop
qmenufullscreenwindows
3 Posts 2 Posters 95 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.
  • F Offline
    F Offline
    FDK2099
    wrote last edited by
    #1

    Hi Qt community,

    I’m working on a QMainWindow in fullscreen mode (Qt::WindowFullScreen) and want to open a context menu from a keyboard shortcut.

    Here is a simplified code:

    void Factory::createSampleMenu()
    {
        QMenu *menu = new QMenu(); // tried with/without parent
        menu->addAction("Action 1");
        menu->addAction("Action 2");
    
        QPoint pos = QCursor::pos();
        menu->exec(pos); // also tried popup()
    }
    

    Behavior:

    • On Ubuntu (X11/Wayland): menu shows above fullscreen window correctly.
    • On Windows 10/11: menu appears under fullscreen window (invisible).

    Things I tried:

    • Qt::Popup, Qt::Tool, Qt::WindowStaysOnTopHint
    • With/without parent (_mainWindow or nullptr)
    • Both exec() and popup()

    But the menu is still hidden below the fullscreen window.

    Questions:

    1. Is this a known limitation of Windows with Qt popups in fullscreen?
    2. Is there a Qt-only workaround to make QMenu float above a fullscreen QMainWindow?
    3. Or is the only option to use native WinAPI (SetWindowPos(HWND_TOPMOST, ...))?

    Environment:

    • Qt 5.x
    • Windows 10
    • Works fine on Ubuntu

    Any advice, workarounds, or best practices would be greatly appreciated.

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

      Hi and welcome to devnet,

      Which version of Qt 5 exactly ?
      Do you have the same issue if you use Qt 6 ?

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

      F 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Which version of Qt 5 exactly ?
        Do you have the same issue if you use Qt 6 ?

        F Offline
        F Offline
        FDK2099
        wrote last edited by
        #3

        @SGaist said in QMenu appears under fullscreen MainWindow on Windows (works on Ubuntu):

        Hi and welcome to devnet,

        Which version of Qt 5 exactly ?
        Do you have the same issue if you use Qt 6 ?

        Hi
        I’m currently using Qt 5.15.2 on Windows 10.

        I need to continue my project with Qt 5, and at the moment I don’t have the possibility to switch versions to check whether it works correctly with Qt 6.

        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