Skip to content

qtutils 4.3.0

Choose a tag to compare

@github-actions github-actions released this 27 Oct 12:23
· 20 commits to master since this release
52c85fb

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 .ui files are sharp on high DPI displays under PyQt5 and PyQt6 (#46).
    PyQt's uic builds each icon of a .ui file from a single pixmap, which never gets
    the @2x image, so under PyQt5 and PyQt6 every such icon was drawn from the 16×16
    image and scaled up. UiLoader now sets every icon of the file again after loading,
    with both images, under all three bindings. A .ui file needs no change.
  • Icons are sharp on a high DPI screen attached after the application started
    (#46). Qt adds the @2x image 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 by UiLoader and icons made with the new qtutils.icons.Icon have both images
    in every case, and Qt draws the one for the screen that the window is on.
  • Under PyQt5, importing qtutils.icons enables high DPI pixmaps (#46). Without
    Qt.AA_UseHighDpiPixmaps, Qt 5 never draws the 32×32 image.

New

  • qtutils.icons.Icon(path) (#46): a QIcon of the image at path and its @2x
    variant, for icons made in code, such as Icon(':/qtutils/fugue/tick').
    add_file(icon, path, size, mode, state) does the same for one image of an existing
    icon, and in_mode(icon, mode) renders an icon in a mode, such as Disabled, at
    both scales, for an icon that is shown greyed out on an enabled widget.
  • qtutils.iconlabel.IconLabel (#46): a widget that displays a QIcon, in place of
    a QLabel with a pixmap. A pixmap holds one image, so a label was drawn from the
    16×16 image on every screen; an IconLabel paints its icon from the image for the
    screen that it is on, at the style's small icon size, in Disabled mode when the
    widget is disabled. In Qt Designer, promote a QWidget to IconLabel with the
    header qtutils/widgets.h; UiLoader registers the class.

Contributors

@chrisjbillington and Claude (Anthropic's AI model), which made the changes in this
release.