Results 1 to 14 of 14

Thread: Bring application window to front

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Bring application window to front

    You can always use the SendMessage() WinAPI call to deliver a custom message to another application and then you can catch that message there and use raise() and setActiveWindow() (or whatever other combination you find useful).
    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.


  2. #2
    Join Date
    Jun 2009
    Posts
    10

    Default Re: Bring application window to front

    I have exactly such implementation with SendMessage() as you say.
    But raise() and activateWindow() and many others WinAPI calls did not worked!

    Yesterday, i have found the problem.
    It used AllowSetForegroundWindow() call which made the raise() call work. I think it was because raise() is implemented through SetForegroundWindow() API.

    Thanks to all.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Bring application window to front

    Quote Originally Posted by St@n View Post
    I have exactly such implementation with SendMessage() as you say.
    But raise() and activateWindow() and many others WinAPI calls did not worked!
    How exactly did you call them?
    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.


  4. #4
    Join Date
    Jun 2009
    Posts
    10

    Default Re: Bring application window to front

    mainDialog->activateWindow()
    mainDialog->raise()

    PS: Problem is resolved

  5. #5
    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: Bring application window to front

    can u put some example code of how exactly u did it..?

  6. #6
    Join Date
    Jul 2010
    Location
    Ahmedabad,Gujarat,India
    Posts
    25
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Bring application window to front

    Try this it might be helps you.

    this->stackUnder(parentWidget()); [this means is your QMainWindow]

  7. #7
    Join Date
    Jul 2019
    Posts
    1
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows Android

    Default Re: Bring application window to front

    Quote Originally Posted by pavanbarot View Post
    Try this it might be helps you.

    this->stackUnder(parentWidget()); [this means is your QMainWindow]
    I used the following code to make a PyQt4 window the topmost window and to bring it to the front (in front of all other windows) in a Windows 10 64 bit environment:

    self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint )

    # The following is drawn from: https://stackoverflow.com/questions/...p-to-the-front
    # the following will remove minimized status
    # and restore window with keeping maximized/normal state
    self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)

    # this will activate the window
    self.activateWindow()

Similar Threads

  1. Replies: 11
    Last Post: 15th July 2008, 13:11
  2. Qt3 Bring to front application
    By nleverin in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2008, 11:27
  3. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 11:07
  4. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41
  5. Replies: 0
    Last Post: 21st February 2006, 16:30

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.