Results 1 to 11 of 11

Thread: Qt::WindowStaysOnTopHint not working properly

  1. #1
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Question Qt::WindowStaysOnTopHint not working properly

    I have a class named BaseDialog which inherits QFrame. All other dialogs inherits BaseDialog. These dialogs contain 3 QGroupBox which inturn contains QLineEdit and QPushButton.
    I used the flag Qt::WindowStaysOnTopHint so that my dialog always remain on top irrespective of the focus.
    This flag didn't work on my system(RHEL 6). So I used the flag Qt::X11BypassWindowManagerHint.
    Above issue was resolved but dialog stopped taking any keyboard input.
    So whenever I enabled my dialog for the first time, i manually activated the dialog using activatewindow().
    As soon as I click outside the dialog, it is deactivated. I reimplemented FocusInEvent(). It is working fine if I click at top. But if I click at QGoupBox or QLineEdit inside that dialog, it is not activated.

    Please tell me is there any way that this problem can be solved without using activateWindow() with each QLineEdit?(As there as many QLineEdits in every dialog )

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt::WindowStaysOnTopHint not working properly

    You should focus on this part:
    This flag didn't work on my system(RHEL 6). So I used the flag Qt::X11BypassWindowManagerHint.
    Namely why it didn't work on your system. The system doesn't have much to do with this, it is the window manager that either respects this flag or not. Bypassing the WM completely is probably a bad idea since you loose features such as moving the widget around.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Qt::WindowStaysOnTopHint not working properly

    Sorry, but I meant Window manager only. Even after setting that flag, window didnt stayed at top'. So I used that flag to bypass. (It was suggested in Qt help)

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt::WindowStaysOnTopHint not working properly

    What window manager are you using?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Qt::WindowStaysOnTopHint not working properly

    X window Manager.


    Added after 37 minutes:


    X window Manager Metacity
    Last edited by swarnika; 11th April 2013 at 10:23.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt::WindowStaysOnTopHint not working properly

    Metacity supports this flag without problems.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Qt::WindowStaysOnTopHint not working properly

    But it is not working in my case. Can you please tell me what might be other reasons?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt::WindowStaysOnTopHint not working properly

    I have no idea. Show your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Qt::WindowStaysOnTopHint not working properly

    I am providing you code for BaseDialog class.

    I ran my application in another system using X window manager compiz-gtk. It is working fine in that system.
    Attached Files Attached Files

  10. #10
    Join Date
    Apr 2013
    Posts
    6
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Qt::WindowStaysOnTopHint not working properly

    I have observed one more thing.

    My application contains a main widget(QWidget). When this dialog pops up on the application, this flag doesnt seem to work. But if I minimize my application, dialog always stays at top hint.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt::WindowStaysOnTopHint not working properly

    Please show your code. What you have shown so far is of little value.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 7th December 2011, 00:49
  2. mapToGlobal/mapFromGlobal isn't working properly
    By janderson.daz in forum Qt Programming
    Replies: 7
    Last Post: 13th April 2011, 22:03
  3. memcpy not working properly
    By sattu in forum Qt Programming
    Replies: 3
    Last Post: 26th October 2010, 23:33
  4. ScrollZoomer not working properly..
    By Raghaw in forum Qwt
    Replies: 1
    Last Post: 30th October 2009, 06:51
  5. Replies: 1
    Last Post: 1st June 2006, 23:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.