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. Toolbar icons resolution in Qt application and dark/light modes
Forum Updated to NodeBB v4.3 + New Features

Toolbar icons resolution in Qt application and dark/light modes

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

    Hello,
    I cannot seem to find a good guide on toolbar icons best practices. Can you please help me with these questions:

    1. Is PNG the best format for icons?
    2. I see 16x16, 32x32, 64x64, 256x256, etc. Looks like I need to have all different sizes available. Does Qt do auto-sizing of icons? Wondering if I can have one large size and have Qt automatically size the icons?
    3. Do we need to separate light mode and dark mode icons? Does Qt Creator use just one set of icons and either invert OR color the background? I couldn't figure out by looking at the source code.

    Thanks.

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

      Hi
      1: its a good format in both speed and size.
      However, SVG can also be used and they can be scaled good.
      However, dont expect a perfect result for say 16x16 as there is a reason that people
      hand resize the icons and fix up some of them to look better in very small.
      2: That is the normal way for max fidelity as then no scaling and you know how all will look.
      QIcon can scale icons.

      QPixmap pixmap = icon.pixmap(QSize(22, 22), // ask for a 22x22 icon
                                         isEnabled() ? QIcon::Normal
                                                     : QIcon::Disabled,
                                         isChecked() ? QIcon::On
                                                     : QIcon::Off);
      

      so yes you can have one large one and it will try its best for smaller.
      Do note, QIcon is no so happy to scale up.

      3: Nope. Icons wont follow dark/light at all. you need 2 sets or
      add some code to Darkify them before use.
      Other option is to use tool like ImageMagick
      to automatically do something to the light icon set to make it dark.

      J 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        1: its a good format in both speed and size.
        However, SVG can also be used and they can be scaled good.
        However, dont expect a perfect result for say 16x16 as there is a reason that people
        hand resize the icons and fix up some of them to look better in very small.
        2: That is the normal way for max fidelity as then no scaling and you know how all will look.
        QIcon can scale icons.

        QPixmap pixmap = icon.pixmap(QSize(22, 22), // ask for a 22x22 icon
                                           isEnabled() ? QIcon::Normal
                                                       : QIcon::Disabled,
                                           isChecked() ? QIcon::On
                                                       : QIcon::Off);
        

        so yes you can have one large one and it will try its best for smaller.
        Do note, QIcon is no so happy to scale up.

        3: Nope. Icons wont follow dark/light at all. you need 2 sets or
        add some code to Darkify them before use.
        Other option is to use tool like ImageMagick
        to automatically do something to the light icon set to make it dark.

        J Offline
        J Offline
        JohnGa
        wrote on last edited by
        #3

        @mrjj Thank you so much for the answers.

        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