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. QIcon from theme feature
QtWS25 Last Chance

QIcon from theme feature

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.9k 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.
  • A Offline
    A Offline
    Alexey Serebryakov
    wrote on last edited by
    #1

    I've try to use icon from theme, like this

    QIcon icon = QIcon::fromTheme(QStringLiteral("view-refresh"));

    On Linux is okay but on Windows is nothing. Why?

    Ok, what the strange myth of string "view-refresh"? Looking at https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html I found the hard coded theme names for free desktop.

    Is it OS specific? Or OS desktop manager specific? How can I fix it qiuckly particular on Windows? :-)

    Thanks a lot guys, that forum is very useful for beginers and expirienced user of Qt exactly!

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      What version of Qt are you using?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      A 1 Reply Last reply
      0
      • VRoninV VRonin

        What version of Qt are you using?

        A Offline
        A Offline
        Alexey Serebryakov
        wrote on last edited by
        #3

        @VRonin 5.12.9

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          Windows does not have a platform theme, you can create a custom one based on something like this example.
          You can take Icons from KDE's Breeze or Oxygen, they use LGPL 3 as license

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          A 1 Reply Last reply
          2
          • VRoninV VRonin

            Windows does not have a platform theme, you can create a custom one based on something like this example.
            You can take Icons from KDE's Breeze or Oxygen, they use LGPL 3 as license

            A Offline
            A Offline
            Alexey Serebryakov
            wrote on last edited by
            #5

            @VRonin Oh thank you. But how it works? I need create theme and include it in my project and distribute package?

            VRoninV 1 Reply Last reply
            0
            • A Alexey Serebryakov

              @VRonin Oh thank you. But how it works? I need create theme and include it in my project and distribute package?

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by VRonin
              #6

              @Alexey-Serebryakov said in QIcon from theme feature:

              I need create theme and include it in my project and distribute package?

              Yes, for example, for breeze icons using MinGW, clone the repository (git clone https://invent.kde.org/frameworks/breeze-icons.git) then run

              mkdir build && cd build
              cmake -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=RELEASE ../
              cmake --build .
              

              (for MSVC replace MinGW Makefiles with NMake Makefiles)

              Now in build\icons\res edit with notepad breeze-icons.qrc and change the second line from <qresource> to <qresource prefix="icons/Breeze">
              Finally move all the contents of this folder into your project and add breeze-icons.qrc as a resource to it.
              Make sure you also distribute the license file with your app to comply with LGPL 3.
              To use it when the platform theme is not available, in your main() add:

              if (QIcon::themeName().isEmpty())
                  QIcon::setThemeName("Breeze");
              

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              2

              • Login

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