stephelton
12th January 2013, 06:33
I want to make a color picker available via a QPushButton. The button should have a color swatch (a QIcon) indication the object's current color. I need this to work adequately on both low and high dpi devices. How can I create an icon of the appropriate size?
Added after 29 minutes:
Here's one possible solution... correct me if there is a better way.
QSomeWidget* widget ...
QFont font = QApplication::font( widget );
QFontMetrics metrics( font );
int size = metrics.height() * 0.75f;
QIcon( size, size );
...
Added after 29 minutes:
Here's one possible solution... correct me if there is a better way.
QSomeWidget* widget ...
QFont font = QApplication::font( widget );
QFontMetrics metrics( font );
int size = metrics.height() * 0.75f;
QIcon( size, size );
...