Did you try to invoke the QWidget::activateWindow() method (together with raise())?
Did you try to invoke the QWidget::activateWindow() method (together with raise())?
Yes, I see I failed to copy&paste all the things I tried. Here they are:
activateWindow();
setFocus( Qt::OtherFocusReason );
show();
setWindowState( Qt::WindowActive );
update();
repaint();
setVisible( true );
raise();
As you can see, I was getting frustrated/desperate/confused ...
According to the docs, you should call QWidget::setActiveWindow() (or rather QApplication::setActiveWindow() as it should be written):So such combo:void QtSingleApplication::activateMainWidget () [virtual slot]
Calls QWidget::setActiveWindow() on this application's mainWidget(). This function does nothing if no main widget has been set.
This slot is typically connected to the messageReceived() signal.
See also messageReceived().should be enough. Maybe somebody else knows the answer, but you can always try the OS specific functions as the last resort.Qt Code:
show(); raise(); activateWindow();To copy to clipboard, switch view to plain text mode
Thank you for your help, jacek, and thank you for redirecting me back to the doc. I had placed the doc aside a while back after many failed attempts and was just trying things by brute force and trial/error.
I need to go back and re-think this from the beginning. The doc mentions setMainWidget() and its relation to activateMainWidget(). Since setMainWidget() was abandoned from Qt3 to Qt4 (I am using Qt4) I was trying to do the equivalent with QMainWindow, setCentralWidget(), and such.
If/When I figure this out, I will post the solution.
Other input/thoughts/suggestions still welcome ...
Bookmarks