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. QSystemTrayIcon and relative path
Forum Updated to NodeBB v4.3 + New Features

QSystemTrayIcon and relative path

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.2k Views 1 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.
  • T Offline
    T Offline
    tobben24
    wrote on last edited by
    #1

    Hi,

    How do you use an relative path on the systemtray icon image file? Right now I am using:

    trayIcon->setIcon(QIcon("absolute path""))

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Use it as with every other relative path. The starting point is the current working directory, that's often the directory containing your exe.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tobben24
        wrote on last edited by
        #3

        Thanks for the reply.

        Okay, but do you know how I can include these image files into the same directory as the exe when I press run in QT Creator?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          A good approach for that small icons is to put them into a "Qt resource file":/doc/qt-4.7/resources.html. This way the icon is compiled into your application exe and you do not need to distribute it separately. Qt Creator has support for creating the resource file, but hand crafting is not difficult either.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobben24
            wrote on last edited by
            #5

            That was the exact answer I was looking for! Thanks:)

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rahul Das
              wrote on last edited by
              #6

              The easiest way must be using the [[doc:resources]]


              Declaration of (Platform) independence.

              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