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 does not seem.
Forum Update on Monday, May 27th 2025

QSystemTrayIcon does not seem.

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 703 Views
  • 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.
  • I Offline
    I Offline
    Ibrahim
    wrote on last edited by
    #1

    Hi; I am using QSystemTrayIcon but icon does not seem. My code:

    QSystemTrayIcon* tray_icon = new QSystemTrayIcon;
    tray_icon->setToolTip("Hello World!");
    tray_icon->showMessage(tr("Message Title"), tr("Hello Everbody!"), QSystemTrayIcon::Critical);
    tray_icon->setVisible(true);
    

    Thanks.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alex_malyu
      wrote on last edited by alex_malyu
      #2

      @Ibrahim said:

      first thing to do:
      "check whether a system tray is present on the user's desktop, call the QSystemTrayIcon::isSystemTrayAvailable() static function."

      if check did not fail mostly likely button is there you just see no icon cause you did not set any.

      #include <QSystemTrayIcon>
      #include <QIcon>
      #include <QDebug>
      #include <QApplication>

      ............
      QSystemTrayIcon* tray_icon = new QSystemTrayIcon (this );
      tray_icon->setToolTip("Hello World!");

      QIcon icon = QApplication::style()->standardIcon( QStyle::SP_ComputerIcon ) ;
      Q_ASSERT( !icon.isNull() );
      
      tray_icon->setIcon( icon );
      tray_icon->show();
      tray_icon->showMessage(tr("Message Title"), tr("Hello Everbody!"), QSystemTrayIcon::Critical );
      
      I 1 Reply Last reply
      1
      • A alex_malyu

        @Ibrahim said:

        first thing to do:
        "check whether a system tray is present on the user's desktop, call the QSystemTrayIcon::isSystemTrayAvailable() static function."

        if check did not fail mostly likely button is there you just see no icon cause you did not set any.

        #include <QSystemTrayIcon>
        #include <QIcon>
        #include <QDebug>
        #include <QApplication>

        ............
        QSystemTrayIcon* tray_icon = new QSystemTrayIcon (this );
        tray_icon->setToolTip("Hello World!");

        QIcon icon = QApplication::style()->standardIcon( QStyle::SP_ComputerIcon ) ;
        Q_ASSERT( !icon.isNull() );
        
        tray_icon->setIcon( icon );
        tray_icon->show();
        tray_icon->showMessage(tr("Message Title"), tr("Hello Everbody!"), QSystemTrayIcon::Critical );
        
        I Offline
        I Offline
        Ibrahim
        wrote on last edited by
        #3

        @alex_malyu thanks. Can I use that in mobile applications (like notification)?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alex_malyu
          wrote on last edited by
          #4

          @alex_malyu said:

          QSystemTrayIcon::isSystemTrayAvailable()

          I have no experience, I think if QSystemTrayIcon::isSystemTrayAvailable() returns there true you can, otherwise you can't.

          1 Reply Last reply
          0

          • Login

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