Repository navigation
qtutils 4.3.0
qtutils 4.3.0 draws every icon from its 32×32 image on high DPI displays, under PyQt5
and PyQt6 as well as PySide6, and on a screen attached after the application started.
It adds IconLabel, a widget for showing an icon in place of a QLabel with a pixmap.
Fixes
- Icons from
.uifiles are sharp on high DPI displays under PyQt5 and PyQt6 (#46).
PyQt'suicbuilds each icon of a.uifile from a single pixmap, which never gets
the@2ximage, so under PyQt5 and PyQt6 every such icon was drawn from the 16×16
image and scaled up.UiLoadernow sets every icon of the file again after loading,
with both images, under all three bindings. A.uifile needs no change. - Icons are sharp on a high DPI screen attached after the application started
(#46). Qt adds the@2ximage to an icon only if a high DPI screen is attached when
the icon is made, so an application started on a 100 % screen drew scaled-up 16×16
icons in a window moved to a 200 % screen attached later, under every binding. Icons
set byUiLoaderand icons made with the newqtutils.icons.Iconhave both images
in every case, and Qt draws the one for the screen that the window is on. - Under PyQt5, importing
qtutils.iconsenables high DPI pixmaps (#46). Without
Qt.AA_UseHighDpiPixmaps, Qt 5 never draws the 32×32 image.
New
qtutils.icons.Icon(path)(#46): aQIconof the image atpathand its@2x
variant, for icons made in code, such asIcon(':/qtutils/fugue/tick').
add_file(icon, path, size, mode, state)does the same for one image of an existing
icon, andin_mode(icon, mode)renders an icon in a mode, such asDisabled, at
both scales, for an icon that is shown greyed out on an enabled widget.qtutils.iconlabel.IconLabel(#46): a widget that displays aQIcon, in place of
aQLabelwith a pixmap. A pixmap holds one image, so a label was drawn from the
16×16 image on every screen; anIconLabelpaints its icon from the image for the
screen that it is on, at the style's small icon size, inDisabledmode when the
widget is disabled. In Qt Designer, promote aQWidgettoIconLabelwith the
headerqtutils/widgets.h;UiLoaderregisters the class.
Contributors
@chrisjbillington and Claude (Anthropic's AI model), which made the changes in this
release.