How can I set Icon size in my application so that it's still scaled when the users uses Screen Scaling?
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 setIconSize(QSize(24, 24));
. Works fine without scaling:
When the Desktop has some scaling enabled, the Icons with the Fixed size don't get scaled, this looks then like this:
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 mImageLabel->setPixmap(icon().pixmap(QSize(24, 24)));
Is there any better why then multiplying with the scale factor? How to get the scale factor?