Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
make a windows notification only without tray icon
AmrCoder last edited by AmrCoder
I want to add to my app notification windows without the tray icon just a notification popup when something happens so I try to use QSystemtryicon class. I used this code.
QSystemTrayIcon *myicon; myicon = new QSystemTrayIcon(this); myicon->setIcon(QIcon(":/Icons/logo.ico")); myicon->setVisible(true); connect(myicon, SIGNAL(messageClicked()), this, SLOT(NotificationClicked())); connect(myicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(NotificationActived(QSystemTrayIcon::ActivationReason)));
and I use this code to popup the notification message
myicon->showMessage("Visited Website","The website visited before",QSystemTrayIcon::Information, 99999);
all I want is to make the message of the notification appeared as long as the user not pressing it or not make any action against it, I try to change the time to long one something like 9999999 in the show message in the last parameter but it not work, is shown for 1 or 2 second and close.
also, I try to make a signal when the user clicks on this notification or close it but it does not work on the notification itself it worked on the tray icon only so I want to make some action when user click on the notification message or close it I used the message clicked but it work only when the user clicks on it if he closes it , it will not work or give any signal i try to use isvisiable to check the message it does not work for the notification message, how to make signal for notification message only.
if there is an external solution like another library I can use to make windows notification without tray icon please add this solution.
all i want is to
1 - make notification stay as long as the user takes an action.
2 - receive a signal when user closes the notification message.
Thanks in advance
Gojir4 last edited by Gojir4
1 - In the doc of QSystemTrayIcon::showMessage(), they say: "On Windows, the millisecondsTimeoutHint is usually ignored by the system when the application has focus." So this could explain why your message doesn't stay longer.