Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSystemTrayIcon on Windows11

QSystemTrayIcon on Windows11

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 482 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by beecksche
    #1

    Hi,
    With the QSystemTrayIcon class I can display messages as banners in Windows 11. But as soon as the timeout hint is over, the banner disappears, but the message is not displayed in the notification list. However, it is activated in the Windows settings.

    If I open the notification list and send a message, it appears in the list. But only as long as the list is open. As soon as the notification list is closed, the message disappears again.

    qsystemtrayicon-ezgif.com-resize.gif

    #include <QApplication>
    #include <QSystemTrayIcon>
    #include <QTimer>
    #include <QStyle>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
    
        QSystemTrayIcon systemTrayIcon;
        systemTrayIcon.setIcon(QApplication::style()->standardIcon(QStyle::SP_ComputerIcon));
        systemTrayIcon.show();
    
        QTimer timer;
        timer.setSingleShot(true);
        QObject::connect(&timer, &QTimer::timeout, [&systemTrayIcon]()
        {
            systemTrayIcon.showMessage("My Title", "My Message");
        });
    
        timer.start(0);
    
        return a.exec();
    }
    

    Using Qt 5.15 and Qt 6.6.2

    EDIT:
    The problem occures also in the official shell api example by Microsoft: https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/Win7Samples/winui/shell/appshellintegration/NotificationIcon

    Found WinToast which works fine!

    1 Reply Last reply
    0
    • beeckscheB beecksche has marked this topic as solved on

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved