How to get HWND from QSystemTrayIcon to show the growl on windows(qt 5.3)

  • @
    QSystemTrayIconPrivate * const myQSystemTrayIconPrivate = reinterpret_cast<QSystemTrayIconPrivate *>(qGetPtrHelper(d_ptr));//where d_ptr was QObjectData of QSystemTrayIcon

    QWidget *widget1 = (QWidget *)myQSystemTrayIconPrivate ->sys;

    In qt 4.8.5, above code was working fine. But when we ported to qt 5.3, above code does not work.

    We also noticed many changes in qt 5.3 related to QSystemTrayIcon. In qt 4.8.5, QSystemTrayIconPrivate class was declared as friend to QSystemTrayIconSys but it in qt 5.3 it is removed.

    And also, QSystemTrayIconSys class was derived from QWidget but in latest qt, it is removed.

    How can we get the HWND from QSystemTrayIconSys object?

  • Lifetime Qt Champion


    If you want to do notifications, why not just use QSystemTrayIcon's showMessage ?

  • Thanks for the reply. but we want to change the HIcon which would be shown in the message. previously we were setting it by

    tnd.hWnd = widget1->winId();
    tnd.hIcon = myIcon; //where myIcon is of hIcon what we want to display

    ::Shell_NotifyIcon(NIM_MODIFY, &tnd);

    Is there any other way to change the hicon of the message

  • Lifetime Qt Champion

    In Qt 5 I don't know, however, since 10.8 there's a notification service inside OS X directly so growl might not be used and the icon ignored.

    But, you might want to open a feature request to add support for custom icons on the "bug report system":

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.