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] SysTray svg icon missing on Windows 7

[Solved] SysTray svg icon missing on Windows 7

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.4k 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.
  • T Offline
    T Offline
    texpert
    wrote on 25 Apr 2014, 21:01 last edited by
    #1

    I am writing a small program - the SysTray svg icon is visible on Ubuntu (though in a wrong place), but completely missing - just an empty space - on Windows 7 (though the context menu is available when right-clicking on this empty space).

    At runtime there are two error lines in the application console:

    Cannot open file ':/dch.svg', because: Unknown error
    Cannot open file ':/dch.svg', because: Unknown error

    at this string of loading the icon:

    QIcon *SysTrayIcon = new QIcon(":/dch.svg");

    It is Windows 7 32-bit, Qt 5.2.1, MinGW48-32

    All the libraries are written in .pro file and made available in the build folder and sub-folders "platforms" and "plugins". When opening the .qrc file in QtCreator, the icon is perfectly displayed.

    Have tried to change the slash to backslash, to put the icon in build folder, not in /res, another folder up, root folder - no way.

    Sincerely yours, amigos!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Apr 2014, 21:56 last edited by
      #2

      Hi and welcome to devnet,

      IIRC you would need the QtSvg module to load svg files.

      On a side note, you shouldn't need to allocate a QIcon on the heap. You are probably creating a memory leak here

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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        texpert
        wrote on 25 Apr 2014, 22:17 last edited by
        #3

        Qt5Svg is and was here all the time with no success...

        Thank you for the side note - I am new to C++, just learning :)

        @ QIcon SysTrayIcon;
        SysTrayIcon.addFile(":/dch.svg");
        @

        But the icon still missing...

        Sincerely yours, amigos!

        1 Reply Last reply
        0
        • T Offline
          T Offline
          texpert
          wrote on 27 Apr 2014, 01:14 last edited by
          #4

          Problem solved removing the language from ,qrc file

          Sincerely yours, amigos!

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Eddy
            wrote on 27 Apr 2014, 18:18 last edited by
            #5

            Hi,

            Please add [solved] to the title of your first post to inform others

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 27 Apr 2014, 19:19 last edited by
              #6

              Out of curiosity, what do you mean by removing the language from the qrc file ?

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

              1 Reply Last reply
              0
              • T Offline
                T Offline
                texpert
                wrote on 27 Apr 2014, 22:43 last edited by
                #7

                @<RCC>
                <qresource lang="en" prefix="/">
                @

                My Windows 7 is russian, so now I think specifying lang="en" wasn't exactly smart :) but Im just learning...

                Sincerely yours, amigos!

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 28 Apr 2014, 07:32 last edited by
                  #8

                  Thanks for the reminder, I've forgot that technique :)

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

                  1 Reply Last reply
                  0

                  8/8

                  28 Apr 2014, 07:32

                  • Login

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