[vlc-devel] [PATCH] qt/pref: fix toolbar icon or text beeing cropped on Hi-DPI displays
pierre
pierre at videolabs.io
Wed Sep 13 14:48:26 CEST 2017
On Wednesday, September 13, 2017 2:18:08 PM CEST Francois Cartegnie wrote:
> Le 13/09/2017 à 14:10, pierre a écrit :
> > QToolButton* btnOk = new QToolButton();
> > //icon.png is 64x64
> > btnOk->setIcon(QIcon(":/img/icon.png"));
> > btnOk->setIconSize(QSize(40, 40));
> > btnOk->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
> > btnOk->setText("not cropped");
> >
> > QToolButton* btnKo = new QToolButton();
> > btnKo->setIcon(QIcon(":/img/icon.png"));
> > btnKo->setIconSize(QSize(120, 40));
> > btnKo->setText("cropped");
> > btnKo->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
>
> And that's what documentation says and explains cropping:
>
> "The default size is defined by the GUI style. This is a maximum size
> for the icons. Smaller icons will not be scaled up."
>
> So an arbitrary 40px. It really needs the real size.
Yes, but the 40px is smaller than the 64px from our icon, Qt is supposed to
scale down our image
NB: We obtain the same behavior with a QSize( 32, 16 ) both beeing smaller
than 64.
Scaling down images ressources is necessary if we want to be able to provide
assets with bigger resolutions for HiDPI (asside loading a special resource
with @2x)
--
Pierre Lamot
More information about the vlc-devel
mailing list