ActiveWindow() don't run on mac
-
Hi and welcome to devnet,
Without any code and no Qt version nobody's gonna be able to help you. Please show us the code that is not working for you.
-
Sorry, this is my mistake
I use qt5.0.2 on mac. I have a QSystemTrayIcon, in the case my application is obscured by other window and i want to active it when click TrayIcon. My code is simple:
@
void MainWindow::clickSysTrayIcon(QSystemTrayIcon::ActivationReason reason)
{
activeWindow();
}
@I also try to use:
@
void MainWindow::clickSysTrayIcon(QSystemTrayIcon::ActivationReason reason)
{
show();
raise();
activeWindow();
}
@but nothing happen, it still under the other window. can you help me ?
thanks -
It might be just a typo on your side but shouldn't you be using activateWindow ? activeWindow will return the top-level window that has the keyboard focus.
-
As SGaist indicated, it appears that you should be using the QWidget::activateWindow() call on your main window object (it's 'activate', not 'active').
Unless there are some side effects or bugs in Qt under Windows, your code using activeWindow() should not bring your main window to the top.