Results 1 to 10 of 10

Thread: window on top of an application

  1. #1
    Join Date
    Mar 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default window on top of an application

    Hello experts,

    I want to pop up a window ( may be part of same application or as a different application/process ), which stays always on top of the our application's main window. The window that pops up is playing a video. When video window is on top we should be able to interact with the main window(like a modeless dialog). During the the interaction with the main window it might happen that a modal dialog pops up. When a modal dialog pops up user should be able to interact with video window ( lets say pause the video) and also with the modal dialog ( close or press OK on the dialog).
    Also user may switch to other applications running on the machine. whatever happens , whenever our application is active , the video window should be on top of it and user should be able to interact with the main window and any other modal dialog that appears and also with the video window.
    Also user should be able to switch to other applications ( MS-Word,excel etc) with normal behavior ( no video window on top of other applications ).

    Please suggest how can I do that?

    Thanks
    Siddharth

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: window on top of an application

    take a look at QWidget::setWindowFlags + Qt::WindowStaysOnTopHint.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Mar 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: window on top of an application

    Qt::WindowStaysOnTopHint brings the window on top but you can not do anything on window ( e.g. press buttons on that window), if there is another modal dialog open and unless you close the modal dialog.

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: window on top of an application

    if a widget, for which Qt::WindowStaysOnTopHint has been set, is not a modal then everything should work.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Mar 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: window on top of an application

    window which is on top is not modal, and lets say we have a push button on this window.
    and if there is another modal dialog pops up then we can not press the push button on the window unless we close the modal dialog, even though Qt::WindowStaysOnTopHint is set for the window.

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: window on top of an application

    probably I don't understand what you need.
    take a look at $QTDIR/examples/widgets/windowflags example.
    make a preview window as always on top and try to play with controls of settings window.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #7
    Join Date
    Mar 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: window on top of an application

    Ok Lets say we have a main window which is derived from QMainWindow. Now when the application is running, due to some event a modeless window appears. this modeless window has a push button. Since this is modeless window user can interact with mainwindow. So far so good.
    Lets say user does something on a main window ( may be pressed any button or invoked any context menu ) due to which a modal dialog appears. Now user wants to press the button on modeless window. he can not do it unless he closes the modal dialog.
    I want that user should be able to press the button on modeless window, even if a modal dialog is active.
    I saw the windowsflags example but i could not get what i'm looking for.

  8. #8
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: window on top of an application

    I'm afraid that you should not use modal dialogs in this case.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  9. #9
    Join Date
    Mar 2009
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: window on top of an application

    Hello spirit,

    Thanks for your answer!!

    Basically I can not avoid or get rid of modal dialogs from the application.
    Can I make this modeless dialog as part of different application in such a way that it remains on top of my main application, and this way it will not be affected by modal dialogs in the main application.

    If I can do this then I guess I would need to synchronize the windows of two different apllications.
    Is there is any way in QT to handle the windows of two different applications?

    Thanks again!!

  10. #10
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: window on top of an application

    dont pass the parent to your modeless window... set the parent 0 .. now hopefully the other model dialogs should not block your parentless window..

Similar Threads

  1. Bring application window to front
    By St@n in forum Qt Programming
    Replies: 13
    Last Post: 5th July 2019, 01:55
  2. Replies: 2
    Last Post: 10th December 2009, 07:01
  3. Replies: 2
    Last Post: 9th August 2009, 22:08
  4. Replies: 11
    Last Post: 15th July 2008, 13:11
  5. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 11:07

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.