Skip to content

Commit f8b7cc6

Browse files
author
Axel Hörteborn
committed
Minor updates to the layout and a qt6 fix
1 parent bdb45c3 commit f8b7cc6

3 files changed

Lines changed: 54 additions & 54 deletions

File tree

GeoDataFarm.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,17 @@ def run(self: Self, test_mode: bool=False) -> None:
495495
# Create the dock_widget (after translation) and keep reference
496496
self.dock_widget = GeoDataFarmDockWidget()
497497
img = QImage(icon_path)
498-
pimg = QPixmap.fromImage(img).scaled(91, 91,
499-
QtCore.Qt.KeepAspectRatio)
498+
499+
if hasattr(QtCore.Qt, "AspectRatioMode"): # Qt6+
500+
KeepAspectRatio = QtCore.Qt.AspectRatioMode.KeepAspectRatio
501+
SmoothTransformation = QtCore.Qt.TransformationMode.SmoothTransformation
502+
else: # Qt5
503+
KeepAspectRatio = QtCore.Qt.KeepAspectRatio
504+
SmoothTransformation = QtCore.Qt.SmoothTransformation
505+
506+
# Now your original line, compatible with both:
507+
pimg = QPixmap.fromImage(img).scaled(91, 91, KeepAspectRatio, SmoothTransformation)
508+
500509
self.dock_widget.LIcon.setPixmap(pimg)
501510
if self.get_database_connection():
502511
self.set_buttons()

0 commit comments

Comments
 (0)