title: How to set fixed Icon size that scales with HiDPI in Qt
body: <p>How can I set Icon size in my application so that it's still scaled when the users uses Screen Scaling?</p>
  <p>In my application I have a QToolBar in the MainWindow that seems to use an Icon size of 24x24. I have some QToolButton which seem to get an Icon size of 20x20 by default, so I had to manually set it to 24x24 in order to have all Icons with same size, with <code>setIconSize(QSize(24, 24));</code>. Works fine without scaling:</p>
  <p><a href="https://i.stack.imgur.com/Agxfn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Agxfn.png" alt="enter image description here" /></a></p>
  <p>When the Desktop has some scaling enabled, the Icons with the Fixed size don't get scaled, this looks then like this:</p>
  <p><a href="https://i.stack.imgur.com/RjKEr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RjKEr.png" alt="enter image description here" /></a></p>
  <p>Another use case that I have is showing Icons in QLabels, there I have to specify the size when converting QIcon to QPixmap, this also doesn't scale <code>mImageLabel-&gt;setPixmap(icon().pixmap(QSize(24, 24)));</code></p>
  <p>Is there any better why then multiplying with the scale factor? How to get the scale factor?</p>