Skip to content

Commit

Permalink
Merge pull request #1148 from nstelter-slac/remove_QWIDGETSIZE_MAX_usage
Browse files Browse the repository at this point in the history
MNT: remove usage of QWIDGETSIZE_MAX macro, since only PyQt defines it and not PySide
  • Loading branch information
jbellister-slac authored Jan 7, 2025
2 parents dd6f38a + a2046b7 commit e320a28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pydm/widgets/analog_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions pydm/widgets/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit e320a28

Please sign in to comment.