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. Remove Qt::WindowStaysOnTopHint flag in linux
Forum Updated to NodeBB v4.3 + New Features

Remove Qt::WindowStaysOnTopHint flag in linux

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.3k Views 3 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.
  • M Offline
    M Offline
    Maluna34
    wrote on last edited by
    #1

    Hi ! :)

    I'm currently trying to add in my Qt app, a "focus" option with which the user can keep the window on top. On Windows system, no problem, but with Linux and Unity, the flag is not always removed and the window remains on top.

    Here is the code :

    void MainWindow::requestFocus()
    {
       setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
       show();
    }
    
    void MainWindow::releaseFocus()
    {
       setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
       show();
    }
    

    I don't know if I really need to add the X11BypassWindowManagerHint flag, it seems to change anything, it removes the window frames, and sometimes it crashes the graphic server.

    I think it's a problem related here : https://forum.qt.io/topic/73740/undoing-setwindowflags Moreover, the multiple addition and suppression of this WindowStaysOnTopHint creates multiple icons in the unity bar and takes more and more time, as if the flags were stacked.

    Thanks for your help !

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

      Hi and welcome to devnet,

      Are you using you're own version of Qt or your distribution one ?

      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
      • M Offline
        M Offline
        Maluna34
        wrote on last edited by Maluna34
        #3

        Hi and thank you for your help.
        I'm using Qt 5.7, so I downloaded it with the online installer : https://www.qt.io/download-open-source/

        Is there a difference between the available online version and the distribution version ?

        mrjjM 1 Reply Last reply
        0
        • M Maluna34

          Hi and thank you for your help.
          I'm using Qt 5.7, so I downloaded it with the online installer : https://www.qt.io/download-open-source/

          Is there a difference between the available online version and the distribution version ?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @Maluna34

          • Is there a difference between the available online version and the distribution version ?

          Hi a key difference is that sometimes Qt is changed to fit the distro so it can work
          with new windows mangers/desktop such as unity.
          So it works say for Main menu that it wants to move it. etc.
          Such things. So its a customized Qt for integration.

          Sometimes its 100% the same and just another version of Qt. version wise.
          Like Qt5.5

          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