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. [solved]Invisible system tray icon
Forum Updated to NodeBB v4.3 + New Features

[solved]Invisible system tray icon

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 972 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.
  • A Offline
    A Offline
    AntonZelenin
    wrote on last edited by AntonZelenin
    #1

    I created tray icon:

    LogWindow::LogWindow(QWidget *parent)
    : QMainWindow(parent)
    {
    ...
    createTrayIcon();
    trayIcon->show();
    ...
    }

    void LogWindow::createTrayIcon()
    {
    trayIcon = new QSystemTrayIcon(this);
    QIcon icon("/Resources/trayIcon.png");
    trayIcon->setIcon(icon);
    }

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        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

        A Offline
        A Offline
        AntonZelenin
        wrote on last edited by
        #3

        @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

        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