Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Focus application for mac



  • Hi all. I use qt for develop mac. My programm run to system tray. If i open window of tray icon and focus on my app that window normal open. If i open window and focus on the other app, window open but it is under other window. How i can set the focus my window ?

    P.S.: Sorry for my english :)



  • I found it :)

    @
    ProcessSerialNumber psn;
    OSErr err;

    err = ::GetCurrentProcess(&psn);
    if (err == noErr)
    ::SetFrontProcess(&psn);

    QWidget::show()
    @

    this help me :)



  • Calling "raise() ":/doc/qt-4.8/qwidget.html#raise should do the trick too.



  • This is indeed a rather complicated way to call "raise()" :-)


Log in to reply