Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Cannot add html links to QSystemTrayIcon



  • Qt 5.3.0, Win7

    Hi,
    How can I add active html links to tray icon, the code below only shows the whole literal string i.e. the viewable string and the anchor string itself, what is wrong?

    @
    QSystemTrayIcon *icon = new QSystemTrayIcon(QIcon(":/icons/google.png"), this);
    if(icon->isSystemTrayAvailable()){
    icon->show();
    icon->showMessage(tr("Search"), tr("Search in Google <a href='https://www.google.com'>www.google.com</a>") ,QSystemTrayIcon::Information, 2000);
    }
    @


  • Lifetime Qt Champion

    Hi,

    AFAIK, it's not possible. However you can use the messageClicked signal to do something like opening the default web browser when a user clicks on the message.



  • Hi SGaist!

    Thanks for the quick response, I will do what you recommend, though its strange that it can't be done.


  • Lifetime Qt Champion

    Not especially strange, Qt uses your OS notification service/framework when available so if this one doesn't support html, there's nothing it can do for you.


Log in to reply