Results 1 to 4 of 4

Thread: SetTopMostWindow in QT

  1. #1
    Join Date
    Jun 2010
    Posts
    32
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default SetTopMostWindow in QT

    I am doing a Windows Application, what I want to achieve is while open a topmost window,when my main processing of a big configuration file starts, inform user the process is still running, after processing finished, then inform user the process has finished.

    at VB6 I can call SetTopMostWindow windows API to achieve this.

    But at QT, I tried a few "on top window flags", it appears only create a modal window. Not what I want.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: SetTopMostWindow in QT

    Qt::WindowStaysOnTopHint looks fairly promising. See the Window Flags Example.

  3. #3
    Join Date
    Jun 2010
    Posts
    32
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: SetTopMostWindow in QT

    With SetTopMostWindow API call, if a window is top most, I still can select other window's tree view control, select an item in that tree view, it leads current top most window refresh its content to what I have selected.

    Can't find this ability in QT. How can I call Windows API from QT, is it possible?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: SetTopMostWindow in QT

    With SetTopMostWindow API call, if a window is top most, I still can select other window's tree view control,
    Yes, Qt::WindowStaysOnTopHint does that.
    select an item in that tree view,
    User inputs, Qt can handle this.
    it leads current top most window refresh its content to what I have selected.
    Your code has to do this - there is no magic, spooky action-at-a-distance that is going to connect these widgets together (in Qt or pure Windows API code). You can use the same mechanism as you use in your other code, or you can use a signal from the tree view connected to a slot in your IAlwaysStayOnTopWindow class. The example I mentioned above does exactly the sort of thing you are asking for; updating the preview list even if the preview window is flagged Qt::WindowStaysOnTopHint. The example is in Assistant and accessible through qtdemo under Widgets.

    You can access the Windows API (or any other) in any way you like from your C++ code. This has nothing to do with Qt. If you need the Windows window handle for a widget then look at the QWidget::winId() method.

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
  •  
Qt is a trademark of The Qt Company.