mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 16:44:16 +02:00
[view] fix: crashing when QT components sizes are not integers
This commit is contained in:
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- UI
|
- UI
|
||||||
- upgrade summary: not displaying the icon type for some applications
|
- upgrade summary: not displaying the icon type for some applications
|
||||||
- displaying initial warnings related to supported technologies even when they are not enabled or have the required dependencies
|
- displaying initial warnings related to supported technologies even when they are not enabled or have the required dependencies
|
||||||
|
- crashing when QT components sizes are not integers [#198](https://github.com/vinifmor/bauh/issues/198)
|
||||||
|
|
||||||
## [0.9.20] 2021-11-05
|
## [0.9.20] 2021-11-05
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ class FormComboBoxQt(QComboBox):
|
|||||||
self.view().setCursor(QCursor(Qt.PointingHandCursor))
|
self.view().setCursor(QCursor(Qt.PointingHandCursor))
|
||||||
|
|
||||||
if model.max_width > 0:
|
if model.max_width > 0:
|
||||||
self.setMaximumWidth(model.max_width)
|
self.setMaximumWidth(int(model.max_width))
|
||||||
|
|
||||||
for idx, op in enumerate(self.model.options):
|
for idx, op in enumerate(self.model.options):
|
||||||
icon = QIcon(op.icon_path) if op.icon_path else QIcon()
|
icon = QIcon(op.icon_path) if op.icon_path else QIcon()
|
||||||
@@ -368,7 +368,7 @@ class FormRadioSelectQt(QWidget):
|
|||||||
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
||||||
|
|
||||||
if model.max_width > 0:
|
if model.max_width > 0:
|
||||||
self.setMaximumWidth(model.max_width)
|
self.setMaximumWidth(int(model.max_width))
|
||||||
|
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
self.setLayout(grid)
|
self.setLayout(grid)
|
||||||
@@ -393,7 +393,7 @@ class FormRadioSelectQt(QWidget):
|
|||||||
col += 1
|
col += 1
|
||||||
|
|
||||||
if model.max_width <= 0:
|
if model.max_width <= 0:
|
||||||
self.setMaximumWidth(self.sizeHint().width())
|
self.setMaximumWidth(int(self.sizeHint().width()))
|
||||||
|
|
||||||
|
|
||||||
class RadioSelectQt(QGroupBox):
|
class RadioSelectQt(QGroupBox):
|
||||||
@@ -472,7 +472,7 @@ class TextInputQt(QGroupBox):
|
|||||||
self.setLayout(QGridLayout())
|
self.setLayout(QGridLayout())
|
||||||
|
|
||||||
if self.model.max_width > 0:
|
if self.model.max_width > 0:
|
||||||
self.setMaximumWidth(self.model.max_width)
|
self.setMaximumWidth(int(self.model.max_width))
|
||||||
|
|
||||||
self.text_input = QLineEditObserver() if model.type == TextInputType.SINGLE_LINE else QPlainTextEditObserver()
|
self.text_input = QLineEditObserver() if model.type == TextInputType.SINGLE_LINE else QPlainTextEditObserver()
|
||||||
|
|
||||||
@@ -483,10 +483,10 @@ class TextInputQt(QGroupBox):
|
|||||||
self.text_input.setPlaceholderText(model.placeholder)
|
self.text_input.setPlaceholderText(model.placeholder)
|
||||||
|
|
||||||
if model.min_width >= 0:
|
if model.min_width >= 0:
|
||||||
self.text_input.setMinimumWidth(model.min_width)
|
self.text_input.setMinimumWidth(int(model.min_width))
|
||||||
|
|
||||||
if model.min_height >= 0:
|
if model.min_height >= 0:
|
||||||
self.text_input.setMinimumHeight(model.min_height)
|
self.text_input.setMinimumHeight(int(model.min_height))
|
||||||
|
|
||||||
if model.tooltip:
|
if model.tooltip:
|
||||||
self.text_input.setToolTip(model.tooltip)
|
self.text_input.setToolTip(model.tooltip)
|
||||||
@@ -514,10 +514,10 @@ class MultipleSelectQt(QGroupBox):
|
|||||||
self.setLayout(self._layout)
|
self.setLayout(self._layout)
|
||||||
|
|
||||||
if model.max_width > 0:
|
if model.max_width > 0:
|
||||||
self.setMaximumWidth(model.max_width)
|
self.setMaximumWidth(int(model.max_width))
|
||||||
|
|
||||||
if model.max_height > 0:
|
if model.max_height > 0:
|
||||||
self.setMaximumHeight(model.max_height)
|
self.setMaximumHeight(int(model.max_height))
|
||||||
|
|
||||||
if model.label:
|
if model.label:
|
||||||
line = 1
|
line = 1
|
||||||
@@ -567,10 +567,10 @@ class FormMultipleSelectQt(QWidget):
|
|||||||
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
|
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
|
||||||
|
|
||||||
if model.max_width > 0:
|
if model.max_width > 0:
|
||||||
self.setMaximumWidth(model.max_width)
|
self.setMaximumWidth(int(model.max_width))
|
||||||
|
|
||||||
if model.max_height > 0:
|
if model.max_height > 0:
|
||||||
self.setMaximumHeight(model.max_height)
|
self.setMaximumHeight(int(model.max_height))
|
||||||
|
|
||||||
self._layout = QGridLayout()
|
self._layout = QGridLayout()
|
||||||
self.setLayout(self._layout)
|
self.setLayout(self._layout)
|
||||||
@@ -773,10 +773,10 @@ class FormQt(QGroupBox):
|
|||||||
view = QLineEditObserver() if c.type == TextInputType.SINGLE_LINE else QPlainTextEditObserver()
|
view = QLineEditObserver() if c.type == TextInputType.SINGLE_LINE else QPlainTextEditObserver()
|
||||||
|
|
||||||
if c.min_width >= 0:
|
if c.min_width >= 0:
|
||||||
view.setMinimumWidth(c.min_width)
|
view.setMinimumWidth(int(c.min_width))
|
||||||
|
|
||||||
if c.min_height >= 0:
|
if c.min_height >= 0:
|
||||||
view.setMinimumHeight(c.min_height)
|
view.setMinimumHeight(int(c.min_height))
|
||||||
|
|
||||||
if c.only_int:
|
if c.only_int:
|
||||||
view.setValidator(QIntValidator())
|
view.setValidator(QIntValidator())
|
||||||
@@ -837,7 +837,7 @@ class FormQt(QGroupBox):
|
|||||||
field_container.setLayout(QHBoxLayout())
|
field_container.setLayout(QHBoxLayout())
|
||||||
|
|
||||||
if model.max_width > 0:
|
if model.max_width > 0:
|
||||||
field_container.setMaximumWidth(model.max_width)
|
field_container.setMaximumWidth(int(model.max_width))
|
||||||
|
|
||||||
field_container.layout().addWidget(comp)
|
field_container.layout().addWidget(comp)
|
||||||
return field_container
|
return field_container
|
||||||
@@ -847,7 +847,7 @@ class FormQt(QGroupBox):
|
|||||||
chooser.setReadOnly(True)
|
chooser.setReadOnly(True)
|
||||||
|
|
||||||
if c.max_width > 0:
|
if c.max_width > 0:
|
||||||
chooser.setMaximumWidth(c.max_width)
|
chooser.setMaximumWidth(int(c.max_width))
|
||||||
|
|
||||||
if c.file_path:
|
if c.file_path:
|
||||||
chooser.setText(c.file_path)
|
chooser.setText(c.file_path)
|
||||||
@@ -940,7 +940,7 @@ def new_spacer(min_width: int = None) -> QWidget:
|
|||||||
spacer.setProperty('spacer', 'true')
|
spacer.setProperty('spacer', 'true')
|
||||||
|
|
||||||
if min_width:
|
if min_width:
|
||||||
spacer.setMinimumWidth(min_width)
|
spacer.setMinimumWidth(int(min_width))
|
||||||
|
|
||||||
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||||
return spacer
|
return spacer
|
||||||
@@ -986,7 +986,7 @@ class RangeInputQt(QGroupBox):
|
|||||||
self.layout().addWidget(QLabel(model.label.capitalize() + ' :' if model.label else ''), 0, 0)
|
self.layout().addWidget(QLabel(model.label.capitalize() + ' :' if model.label else ''), 0, 0)
|
||||||
|
|
||||||
if self.model.max_width > 0:
|
if self.model.max_width > 0:
|
||||||
self.setMaximumWidth(self.model.max_width)
|
self.setMaximumWidth(int(self.model.max_width))
|
||||||
|
|
||||||
self.spinner = QSpinBox()
|
self.spinner = QSpinBox()
|
||||||
self.spinner.setCursor(QCursor(Qt.PointingHandCursor))
|
self.spinner.setCursor(QCursor(Qt.PointingHandCursor))
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ class InfoDialog(QDialog):
|
|||||||
|
|
||||||
lower_container.layout().addWidget(self.bt_close)
|
lower_container.layout().addWidget(self.bt_close)
|
||||||
layout.addWidget(lower_container)
|
layout.addWidget(lower_container)
|
||||||
self.setMinimumWidth(self.gbox_info.sizeHint().width() * 1.2)
|
self.setMinimumWidth(int(self.gbox_info.sizeHint().width() * 1.2))
|
||||||
self.setMaximumHeight(screen_size.height() * 0.8)
|
self.setMaximumHeight(int(screen_size.height() * 0.8))
|
||||||
self.adjustSize()
|
self.adjustSize()
|
||||||
|
|
||||||
def _gen_show_button(self, idx: int, val):
|
def _gen_show_button(self, idx: int, val):
|
||||||
|
|||||||
@@ -153,9 +153,9 @@ class PreparePanel(QWidget, TaskManager):
|
|||||||
self.app_config = app_config
|
self.app_config = app_config
|
||||||
self.manage_window = manage_window
|
self.manage_window = manage_window
|
||||||
self.setWindowTitle('{} ({})'.format(__app_name__, self.i18n['prepare_panel.title.start'].lower()))
|
self.setWindowTitle('{} ({})'.format(__app_name__, self.i18n['prepare_panel.title.start'].lower()))
|
||||||
self.setMinimumWidth(screen_size.width() * 0.5)
|
self.setMinimumWidth(int(screen_size.width() * 0.5))
|
||||||
self.setMinimumHeight(screen_size.height() * 0.35)
|
self.setMinimumHeight(int(screen_size.height() * 0.35))
|
||||||
self.setMaximumHeight(screen_size.height() * 0.95)
|
self.setMaximumHeight(int(screen_size.height() * 0.95))
|
||||||
self.setLayout(QVBoxLayout())
|
self.setLayout(QVBoxLayout())
|
||||||
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
|
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
|
|||||||
Reference in New Issue
Block a user