[Development] High-dpi Qt best practices
Olivier Goffart
olivier at woboq.com
Tue Oct 9 12:21:05 CEST 2012
On Tuesday 09 October 2012 09:46:37 Sorvig Morten wrote:
> On Oct 9, 2012, at 11:32 AM, Olivier Goffart <olivier at woboq.com>
>
> wrote:
> > But QSize is already the size in pixel.
> > Or do you mean that QIcon::pixmap could return a pixmap that is larger
> > than
> > the given QSize, scaled with some magic heuristics. That is not really
> > intuitive. (and violate the current documentation)
>
> I'm re-defining it to be the size in points. I think this intuitive, you are
> asking QIcon::pixmap() for pixmap suitable for covering this many units on
> screen - not for a pixmap of a specific size.
What is an "unit on screen"? Is it not a pixel?
When you have do QImage(QSize), the image has hight*width pixel, right?
Same for QPixmap? or has a pixmap actually more pixal than its size? (as
returned by QPixmap::size/width/height)
I think it is counter intuitive.
Maybe we can introduce QSizePt
Code would look like
QPixmap p = QIcon::pixmap(QSizePt(20,20).toSize(window));
(but then again, i'd say it is bad practice to even hardcode pt size)
I think there should not be that may use of QIcon::pixmap anyway. It is
mainly going to be used handled QToolBar and similar.
--
Olivier
Woboq - Qt services and support - http://woboq.com
More information about the Development
mailing list