Results 1 to 5 of 5

Thread: Background QT application.

  1. #1
    Join Date
    Sep 2006
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Background QT application.

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Background QT application.

    QWidget::raise() should do the trick.

  3. #3
    Join Date
    Sep 2006
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Background QT application.

    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?"

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: Background QT application.

    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.

  5. #5
    Join Date
    Sep 2006
    Posts
    5
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Background QT application.

    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->setAutoDefault(1);
    $paperbutton->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
    $paperbutton->resize(400, 230);

    $qt_app->connect($paperbutton, SIGNAL('clicked()'), SLOT('quit()'));
    $qt_app->setMainWidget($paperbutton);
    $paperbutton->show;
    $paperbutton->raise;
    $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.

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2006, 18:51
  2. Gnome makes application crash
    By regix in forum Qt Programming
    Replies: 35
    Last Post: 18th August 2006, 19:44
  3. background colour
    By kw in forum Qt Programming
    Replies: 6
    Last Post: 11th April 2006, 00:44
  4. Replies: 1
    Last Post: 5th April 2006, 16:44
  5. Replies: 3
    Last Post: 31st March 2006, 18:38

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.