View Full Version : Background QT application.

12th September 2006, 22:30
I'm working on Linux and I've got an application running in the background that periodically needs to display a window on the screen with a button. Yeah, it's that simple. However, in my test applications that I'm running directly it pops up the window as the top window now problem. But when I run it in the background, it create the window but it's under the window your typing in. How do I get the application to pop to the front of the screen?

12th September 2006, 22:33
QWidget::raise() should do the trick.

12th September 2006, 22:36
The problem is... it doesn't. I do all the setup. Do the QWidget->show(). Then a QWidget->raise(). Then later on in the application when I do the Qapplication->exec it creates the window but doesn't raise to the top. Is there a way to say "ok, you've created the window now raise the damn thing?"

12th September 2006, 23:18
I'd have to see the code. You probably need to exec() the window to make it modal, which is not sure to help much too... Your window manager may be forcing the active window to front. If you look at the FAQ section of this site, you'll find an example of bringing a window to front. Take a look at it, maybe it will help you.

12th September 2006, 23:29
Warning. I'm using perlqt which is using Qt3 since it hasn't been ported yet.

my $paperbutton = Qt::PushButton("Please change the paper.\nPress here to continue.", undef);
$paperbutton->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
$paperbutton->resize(400, 230);

$qt_app->connect($paperbutton, SIGNAL('clicked()'), SLOT('quit()'));
$paperbutton->setActiveWindow ;

Later on in the code I simply do a qt_app->exec ;

the perl code is run in the background effectively from cron.