From 886f7e0972752a72374f989d94edfc02b3c85084 Mon Sep 17 00:00:00 2001 From: chrin Date: Thu, 29 Feb 2024 11:43:25 +0100 Subject: [PATCH] Type casting in Qt for Python 3.10 --- guiframe.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/guiframe.py b/guiframe.py index 901c60b..e7dc229 100644 --- a/guiframe.py +++ b/guiframe.py @@ -1494,7 +1494,7 @@ class GUIFrame(QWidget): line.setStyleSheet("QLabel{text-align: right}") fm = QFontMetricsF(line.font()) param_width = fm.maxWidth() * (len(str(value))*0.5) + 20 - line.setMaximumWidth(param_width) + line.setMaximumWidth(int(param_width)) def prepare_qlineedit(self, line, value, link, title, key): has_min = False @@ -1553,7 +1553,7 @@ class GUIFrame(QWidget): #extra_width = 22 if len(str(value)) < 16 else 26 #line.setFixedWidth(param_width + extra_width) param_width = fm.maxWidth() * (len(str(value))*0.5) + 20 - line.setMaximumWidth(param_width) + line.setMaximumWidth(int(param_width)) return line def prepare_qspinbox(self, line, value, link, title, key): @@ -1568,7 +1568,7 @@ class GUIFrame(QWidget): line.setAlignment(Qt.AlignRight) #required fm = QFontMetricsF(line.font()) param_width = fm.maxWidth() * (len(str(max_val)) + 0.2) - line.setMaximumWidth(param_width) + line.setMaximumWidth(int(param_width)) return line def prepare_qdoublespinbox(self, line, value, link, title, key): @@ -1585,7 +1585,7 @@ class GUIFrame(QWidget): line.setAlignment(Qt.AlignRight) #required fm = QFontMetricsF(line.font()) param_width = fm.maxWidth() * (len(str(max_val))) # + len(str(step))) - line.setMaximumWidth(param_width) + line.setMaximumWidth(int(param_width)) return line def prepare_qcombobox(self, line, value, link, title, key): @@ -1621,7 +1621,7 @@ class GUIFrame(QWidget): widget = QWidget() layout = QGridLayout() layout.setContentsMargins(5, 0, 5, 20) - widget.setMaximumWidth(len(value)*100) + widget.setMaximumWidth(int(len(value)*100)) target_list = value color_list = ["#894961", "teal", "darkblue"] @@ -1844,7 +1844,7 @@ class GUIFrame(QWidget): Qt.AlignmentFlag(Qt.AlignLeft|Qt.AlignVCenter)) icol += 1 lo.addWidget(line, _irow, icol, _irowspan, icolspan, - Qt.AlignmentFlag(Qt.AlignLef | Qt.AlignVCenter)) + Qt.AlignmentFlag(Qt.AlignLeft|Qt.AlignVCenter)) #print(title, tab) #print(key, line, icolumn, wgt_type, text, flush=True) _irow += 1 @@ -1873,7 +1873,7 @@ class GUIFrame(QWidget): #extra_width = 22 if len(str(value)) < 15 else 28 #meas_line.setFixedWidth(param_width + extra_width) param_width = fm.maxWidth() * len(longest_title) - meas_line.setMaximumWidth(param_width*0.5) + meas_line.setMaximumWidth(int(param_width*0.5)) qtab_widget.setContentsMargins(0, 40, 0, 0) qtab_widget.currentChanged.connect(on_tab_change)