PDA

View Full Version : QProcess launches application in the background on MAC 10.6



yeaiping
8th December 2010, 11:39
/sa :http://www.qtcentre.org/threads/30006-Mac-OSX-10.6-QProcess-launches-application-in-the-background

Dear all,

I use QProcess to start another application on Mac, but its' window under other applications'.

Although I use this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint) to resolve this problem, the window on the top always.
I use
QTimer::singleShot(0, this, SLOT(slotCancelTopHint())) to change the window normal (cancel the top flag), and the window display on top at first, but under other application window(eg: Finder etc.) immediately.

Code:

///
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
{
...
this->setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint) ;
QTimer::singleShot(0, this, SLOT(slotCancelTopHint())) ;
}
///
void MainWindow::slotCancelTopHint()
{
#if defined(Q_WS_MAC)
this->setWindowFlags(this->windowFlags() ^ (Qt::WindowStaysOnTopHint));
this->show();
#endif
}

Is there any way to let application's window of use QProcess started on top, not always.

Thanks