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. using qtstyle standard icons in qt designer
Forum Updated to NodeBB v4.3 + New Features

using qtstyle standard icons in qt designer

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 8.9k 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.
  • P Offline
    P Offline
    phirestalker
    wrote on 7 Dec 2015, 04:26 last edited by
    #1

    I have searched everywhere for this, all the answers that say it can't be done are 5 years old. I saw a mailing list for qt say that this functionality was added in qt 4.8. I can not find out how to do it.

    So... how do i use standard pixmaps from qstyle for my qaction icons in qt designer?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 7 Dec 2015, 10:35 last edited by
      #2

      There are two fields for choosing an icon in action editor. One is for resource file and directly above it is a text field for a standard icon from theme.
      The generated code for this uses QIcon::fromTheme() and thus falls under some restrictions: the available names list is listed here.
      Mind the note in the fromTheme() docs - by default it works only on X11. For other platforms you would need a custom theme.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        phirestalker
        wrote on 7 Dec 2015, 15:54 last edited by
        #3

        I know about themes, I was speaking specifically of QStyle::StandardPixmap icons. I would like to use them so it would be consistent across platforms, without having to use someones icon set and have to have an extra file with the license giving credit for the icon set. Is there any way to use QStyle::StandardPixmap in qt designer?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on 7 Dec 2015, 16:17 last edited by
          #4

          I never said anything about providing your own icon files.
          Also, using QStyle::StandardPixmap is not consistent at all. As a matter of fact it's completely the opposite - it provides system specific pixmaps that will vary wildly.

          What I said is you can use theme icons feature. The theme can give you an icon from anywhere. On X11 it will be the system icon. On Windows and Mac you need a custom style that will provide the right icons for QIcon::fromTheme() (implemented using standardIcons() with QStyle::StandardPixmap enum if you want).

          1 Reply Last reply
          0
          • P Offline
            P Offline
            phirestalker
            wrote on 7 Dec 2015, 17:04 last edited by
            #5

            ok, can you give me a link that describes using styles?

            1 Reply Last reply
            0
            • P Offline
              P Offline
              phirestalker
              wrote on 8 Dec 2015, 04:36 last edited by
              #6

              I am reading about stylesheets, but I can't seem to get the search terms right to see the syntax for setting a theme fallback for a specific icon name. Can anyone point me in the right direction?

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Chris Kawa
                Lifetime Qt Champion
                wrote on 8 Dec 2015, 08:58 last edited by
                #7

                Stylesheets are another separate thing. They can't do anything in this particular case.
                I don't know any example I could point you to. I think the easiest would be to take the source of the X11 platform plugin and look there how to implement support for theme icons. It might turn out to be as easy as implementing a method or two in the QProxyStyle subclass, but I've never done it so can't tell you the specifics.

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  phirestalker
                  wrote on 27 Dec 2015, 21:26 last edited by
                  #8

                  I found out that the standard icons are not enough to fill a toolbar. I will just be creating my own icons in inkscape for my apps. Thanks chris for all your help

                  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