Skip to content

UI elements and plot primitives do not adapt to high-DPI / display scaling #60

@ThomasMalletCodra

Description

@ThomasMalletCodra

Describe the bug

PlotPy does not enable any high-DPI Qt attribute on its own (it inherits the host application's bootstrap, typically through guidata.qapplication()). Many of its widgets, panels, and plot primitives use hardcoded pixel values that do not scale with the Windows display factor or with high-DPI monitors. Visible consequences include:

  • default plot symbols rendered at 3×3 pixels (essentially invisible at 200–300%),
  • side panels (cross-section, item list, contrast adjustment) frozen at fixed widths/heights,
  • contrast-adjustment toolbar icons hardcoded at 12×12 px,
  • range-slider stylesheet using hardcoded px values (height: 2px, width: 19.5px, …),
  • colormap manager dialog frozen via setFixedHeight(sizeHint().height()).

This is a global issue — sub-tasks listed below. Two upstream issues are prerequisites for fully resolving this:

To Reproduce

  1. Set Windows display scaling to 200% or 300%
  2. Open a PlotDialog with a curve and an image, enable the cross-section panels and the colormap manager
  3. Observe:
    • curve markers are barely visible,
    • axis ticks/labels are small,
    • cross-section panels are 130 × 140 px regardless of scaling,
    • the contrast-adjustment toolbar uses 12 × 12 icons,
    • the range slider in colormap/contrast looks broken/blurred,
    • the colormap manager dialog cannot grow vertically.

Expected behavior

All plot primitives, panels, dialogs, and stylesheets should scale with the system display factor (using font metrics, style.pixelMetric(), or PythonQwt's dpi_scale helper).

Screenshots

Comparative captures of PlotDialog + side panels + colormap manager at 100% / 200% / 300% will be attached.

Installation information

  • PlotPy version: latest master : 4671cf2
  • Qt binding: PyQt5 / PyQt6 / PySide6
  • OS: Windows 10/11

Additional context — Sub-tasks

SUB-11 · Default symbols and axis fonts (CRITICAL)

  • styles/base.py:56 — QSizeF(3, 3) default symbol size
  • styles/base.py:345 — font.setPointSize(self.size) (often 8/10)
  • builder/curvemarker.py:102 — param.symbol.size = markersize (literal int)
  • widgets/fit.py:209 — setPointSize(font.pointSize() + offset) (base size unsafe)
  • Action: derive defaults from style().pixelMetric(QStyle.PM_DefaultIconSize) and apply PythonQwt's dpi_scale (SUB-3).

SUB-12 · Side panels frozen in pixels (HIGH)

  • panels/contrastadjustment.py:84 — setMinimumHeight(80)
  • panels/contrastadjustment.py:473 — toolbar setIconSize(QSize(12, 12))
  • panels/itemlist.py:55 — setMinimumWidth(140)
  • panels/csection/csplot.py:442 — _HEIGHT = 130 (XCrossSection)
  • panels/csection/csplot.py:456 — _WIDTH = 140 (YCrossSection)
  • plot/plotwidget.py:384 — setMinimumSize(320, 240)
  • plot/base.py:874 — sizeHint = QSize(400, 300)
  • Action: convert to multiples of fontMetrics().height() or style().pixelMetric(QStyle.PM_SmallIconSize).

SUB-13 · Range slider stylesheet (HIGH)

  • external/sliders/_range_style.py:297-321 — height: 2px, width: 19.5px, hardcoded borders/margins
  • Action: build the stylesheet dynamically; multiply px values by devicePixelRatioF() or by a logical-DPI factor.

SUB-14 · Colormap manager (MEDIUM)

  • mathutils/colormap.py:52 — LARGE_ICON_WIDTH, LARGE_ICON_HEIGHT = 80, 16
  • widgets/colormap/manager.py:168 — setIconSize(QSize(80, 16))
  • widgets/colormap/manager.py:245 — setFixedHeight(sizeHint().height())
  • widgets/colormap/widget.py:307 — multi_range_hslider.setMaximumHeight(20)
  • Action: DPI-scale the colormap thumbnail dimensions and remove setFixedHeight(sizeHint()).

SUB-15 · Layout spacings (MEDIUM)

  • widgets/rotatecrop.py:224 — addSpacing(15)
  • widgets/fliprotate.py:197 — addSpacing(10)
  • external/sliders/_labeled.py:176 — setSpacing(1)
  • Action: use fontMetrics().height() / 2 or equivalent.

Dependencies

This issue is downstream of:

Recommended order

SUB-11 and SUB-12 first (most user-visible), then SUB-13 (slider CSS), then SUB-14 / SUB-15.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions