Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved QSystemTrayIcon does not seem.

    General and Desktop
    2
    4
    467
    Loading More Posts
    • 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
      Ibrahim last edited by

      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 Reply Quote 0
      • A
        alex_malyu last edited by 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 1 Reply Last reply Reply Quote 1
        • I
          Ibrahim @alex_malyu last edited by

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

          1 Reply Last reply Reply Quote 0
          • A
            alex_malyu last edited by

            @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 Reply Quote 0
            • First post
              Last post