[solved]Invisible system tray icon

  • I created tray icon:

    LogWindow::LogWindow(QWidget *parent)
    : QMainWindow(parent)

    void LogWindow::createTrayIcon()
    trayIcon = new QSystemTrayIcon(this);
    QIcon icon("/Resources/trayIcon.png");

    But in tray it's invisible, only empty place, and instead of one, appears two 'icons\empty places' and if add events to show\hide window and click each empty place - appears two different windows and I can write different text in each.
    I read something about creating .qrc file and adding 'icon' prefix and file, but I use visual studio qt addin and don't know what I shoulde do there.

  • Lifetime Qt Champion


    It's because your path is absolute thus at run time it tries to find the file in C:/Resources/tryIcon.png. Here you have an explanation on how to handle resource with the Qt Addin.

    Hope it helps

  • @SGaist
    Finally i solved the problem. I just created usual notepad file, then renamed it to .qrc file and in VS it opened without any problems

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.