From a2046b700b7c007f31bb91e2bf3387faa46683ec Mon Sep 17 00:00:00 2001 From: nstelter-slac Date: Mon, 6 Jan 2025 08:32:07 -0800 Subject: [PATCH] MNT: remove usage of QWIDGETSIZE_MAX macro, since only PyQt defines it and not PySide Instead use the value of the macro stated in the docs https://doc.qt.io/qt-6/qwidget.html#QWIDGETSIZE_MAX --- pydm/widgets/analog_indicator.py | 6 ++++-- pydm/widgets/scale.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pydm/widgets/analog_indicator.py b/pydm/widgets/analog_indicator.py index 476eda788..9b7c81467 100644 --- a/pydm/widgets/analog_indicator.py +++ b/pydm/widgets/analog_indicator.py @@ -2,7 +2,6 @@ from qtpy.QtGui import QColor, QPolygon, QPainter, QFontMetrics from qtpy.QtWidgets import QFrame, QSizePolicy from qtpy.QtCore import Qt, QPoint, Property, QSize -from qtpy.QtWidgets import QWIDGETSIZE_MAX from .scale import QScale, PyDMScaleIndicator @@ -55,7 +54,10 @@ def adjust_transformation(self): displayed on left/right also helpful for use in layouts """ - self.setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX) # Unset fixed size + + # We originally used QWIDGETSIZE_MAX here but the macro is only defined in PyQt and not PySide. + # Instead we use it's direct value from the docs: https://doc.qt.io/qt-6/qwidget.html#QWIDGETSIZE_MAX + self.setMaximumSize(16777215, 16777215) # Unset fixed size if self._orientation == Qt.Horizontal: self._widget_width = self.width() self._widget_height = self.height() diff --git a/pydm/widgets/scale.py b/pydm/widgets/scale.py index b6650a7e8..38354e7bd 100644 --- a/pydm/widgets/scale.py +++ b/pydm/widgets/scale.py @@ -2,7 +2,6 @@ from qtpy.QtGui import QColor, QPolygon, QPen, QPainter, QPaintEvent from qtpy.QtWidgets import QFrame, QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QWidget, QGridLayout from qtpy.QtCore import Qt, QPoint, Property -from qtpy.QtWidgets import QWIDGETSIZE_MAX from typing import Optional @@ -64,7 +63,10 @@ def adjust_transformation(self) -> None: This method sets parameters for the widget transformations (needed to for orientation, flipping and appearance inversion). """ - self.setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX) # Unset fixed size + + # We originally used QWIDGETSIZE_MAX here but the macro is only defined in PyQt and not PySide. + # Instead we use it's direct value from the docs: https://doc.qt.io/qt-6/qwidget.html#QWIDGETSIZE_MAX + self.setMaximumSize(16777215, 16777215) # Unset fixed size if self._orientation == Qt.Horizontal: self._widget_width = self.width() self._widget_height = self.height()