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. make a windows notification only without tray icon
Forum Updated to NodeBB v4.3 + New Features

make a windows notification only without tray icon

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.2k Views 2 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.
  • AmrCoderA Offline
    AmrCoderA Offline
    AmrCoder
    wrote on last edited by AmrCoder
    #1

    Hello
    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

    Gojir4G 1 Reply Last reply
    0
    • AmrCoderA AmrCoder

      Hello
      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

      Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on last edited by Gojir4
      #2

      @AmrCoder Hi,

      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.

      1 Reply Last reply
      4

      • Login

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