Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, August 2007
Activate Window


Message 1 in thread

How do I set a window widget to be the active window within my application
without activating the whole application? I have a program that runs
scripts, and often the user wants the scripts to run while working in
another application. These scripts need to activate windows (set the current
window) for my application, but NOT bring the application to the front.
However if, and only if, my application is in front, that window should get
keyboard focus.

Does QWidget::raise() do everything I need? QWidget::activateWindow() brings
my application to the front and interrupts the user's work in another
application, so that is not the correct call. I noticed there is also a
QApplication::setActiveWindow(QWidget*) call that implies it might work
right, but once again the documentation is not clear.

The widget I need to set as active is sometimes a QMdiSubWindow, sometimes a
modal QDialog, and sometimes an undocked QDockWidget. I need this to work
for each possibility.

Keith
**Please do not reply to me, reply to the list.**