我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt5.QtWidgets.QSpinBox()。
def read_settings(self): settings = QtCore.QSettings(self._application, self._section) for key in settings.allKeys(): value = settings.value(key) try: # This is required to skip the tab_position key/value this = getattr(self.ui, key) except: continue if isinstance(this, QW.QLineEdit): this.setText(value) elif isinstance(this, QW.QSpinBox): this.setValue(int(value)) elif isinstance(this, QW.QCheckBox): if value in ['false', False, "False"]: this.setChecked(False) else: this.setChecked(True) elif isinstance(this, FileBrowser): this.set_filenames(value) else: print('could not handle : %s' % this) # The last tab position self._tab_pos = settings.value("tab_position", 0, type=int) self.ui.tabs.setCurrentIndex(self._tab_pos)
def get_settings(self): # get all items to save in settings items = {} names = self._get_widget_names() for name in names: widget = getattr(self.ui, name) if isinstance(widget, QW.QLineEdit): value = widget.text() elif isinstance(widget, QW.QSpinBox): value = widget.value() elif isinstance(widget, QW.QCheckBox): value = widget.isChecked() elif isinstance(widget, QW.QSpinBox): value = widget.value() elif isinstance(widget, FileBrowser): value = widget.get_filenames() else: raise NotImplementedError("for developers") items[name] = value items["tab_position"] = self.ui.tabs.currentIndex() return items
def _get_value(self): """Return a string""" if isinstance(self.widget, QW.QSpinBox): value = self.widget.text() elif isinstance(self.widget, QW.QLabel): value = self.widget.text() elif isinstance(self.widget, FileBrowser): if self.widget.path_is_setup() is False: value = "" else: value = self.widget.get_filenames() else: try: value = self.widget.text() except: print("unknown widget" + str(type(self.widget))) value = "" return value
def __init__(self, text, unit = None, minimum = None, maximum = None, parent = None): """ Initialization of the CfgSpinBox class (used for int values). @param text: text string associated with the SpinBox @param minimum: min value (int) @param minimum: max value (int) """ QWidget.__init__(self, parent) self.spinbox = QSpinBox(parent) if unit is not None: self.setUnit(unit) self.setSpec({'minimum': minimum, 'maximum': maximum, 'comment': ''}) self.label = QLabel(text, parent) self.layout = QHBoxLayout(parent); self.spinbox.setMinimumWidth(200) #Provide better alignment with other items self.layout.addWidget(self.label) self.layout.addStretch() self.layout.addWidget(self.spinbox) self.setLayout(self.layout)
def __init__(self,x_min,x_max,data): QWidget.__init__(self) self.setWindowTitle(_("Poly fit")+"(https://www.gpvdm.com)") self.data=data self.ret_math=None self.ret=None self.interal_data=[] for i in range (0,self.data.y_len): #x_nm= [x * 1e9 for x in self.data.y_scale] x=self.data.y_scale[i] #print(x_min,x,x_max) if x>=x_min and x<=x_max: self.interal_data.append((self.data.y_scale[i],self.data.data[0][0][i])) #print(self.data.y_scale[i],self.data.data[0][0][i]) #frequency, = self.ax1.plot(x_nm,self.data.data[0][0][i], 'bo-', linewidth=3 ,alpha=1.0) #print(self.interal_data) self.main_vbox=QVBoxLayout() self.label = QLabel(_("Polynomial coefficients")) self.main_vbox.addWidget(self.label) self.sp = QSpinBox() self.main_vbox.addWidget(self.sp) self.button = QPushButton(_("Ok"), self) self.button.clicked.connect(self.callback_click_ok) self.main_vbox.addWidget(self.button) self.setLayout(self.main_vbox) ret=False
def __init__(self, mainWindow, staticExportItem): super().__init__(mainWindow, "") self.mainWindow = mainWindow self.staticExportItem = staticExportItem self.layout.insertRow(0, QtWidgets.QLabel("edit block #{}".format(staticExportItem["id"]))) self.name = QtWidgets.QLineEdit(self.staticExportItem["name"]) self.name.selectAll() self.layout.addRow("name", self.name) #self.minimumInTicks = QtWidgets.QSpinBox() self.minimumInTicks = CombinedTickWidget() self.minimumInTicks.setValue(self.staticExportItem["minimumInTicks"]) self.layout.addRow("minimum in ticks", self.minimumInTicks) self.__call__()
def __init__(self, mainWindow): super().__init__(mainWindow, "Instrument Change") self.program = QtWidgets.QSpinBox() self.program.setValue(type(self).lastProgramValue) self.msb = QtWidgets.QSpinBox() self.msb.setValue(type(self).lastMsbValue) self.lsb = QtWidgets.QSpinBox() self.lsb.setValue(type(self).lastLsbValue) self.instrumentName = QtWidgets.QLineEdit() self.shortInstrumentName = QtWidgets.QLineEdit() for label, spinbox in (("Program", self.program), ("Bank MSB", self.msb), ("Bank LSB", self.lsb)): spinbox.setMinimum(0) spinbox.setMaximum(127) spinbox.setSingleStep(1) self.layout.addRow(label, spinbox) self.layout.addRow("Instr.Name", self.instrumentName) self.layout.addRow("Short Name", self.shortInstrumentName) self.insert = QtWidgets.QPushButton("Insert") self.insert.clicked.connect(self.process) self.layout.addWidget(self.insert)
def __init__(self, parent): super().__init__('Margins', parent) self.margin_left_edit = QtWidgets.QSpinBox( self, minimum=0, maximum=999) self.margin_right_edit = QtWidgets.QSpinBox( self, minimum=0, maximum=999) self.margin_vertical_edit = QtWidgets.QSpinBox( self, minimum=0, maximum=999) layout = QtWidgets.QGridLayout(self) layout.setColumnStretch(0, 1) layout.setColumnStretch(1, 2) layout.addWidget(QtWidgets.QLabel('Left:', self), 0, 0) layout.addWidget(self.margin_left_edit, 0, 1) layout.addWidget(QtWidgets.QLabel('Right:', self), 1, 0) layout.addWidget(self.margin_right_edit, 1, 1) layout.addWidget(QtWidgets.QLabel('Vertical:', self), 2, 0) layout.addWidget(self.margin_vertical_edit, 2, 1)
def setupUi(self, Form): Form.setObjectName("Form") sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupBox = QtWidgets.QGroupBox(Form) self.groupBox.setObjectName("groupBox") self.formLayout = QtWidgets.QFormLayout(self.groupBox) self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setObjectName("formLayout") self.nc_label = QtWidgets.QLabel(self.groupBox) self.nc_label.setObjectName("nc_label") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.nc_label) self.nc_spin = QtWidgets.QSpinBox(self.groupBox) self.nc_spin.setObjectName("nc_spin") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.nc_spin) self.verticalLayout.addWidget(self.groupBox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox) self.formLayout_2.setObjectName("formLayout_2") self.halfWindowLabel = QtWidgets.QLabel(self.groupbox) self.halfWindowLabel.setObjectName("halfWindowLabel") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.halfWindowLabel) self.halfWindowSpinBox = QtWidgets.QSpinBox(self.groupbox) self.halfWindowSpinBox.setObjectName("halfWindowSpinBox") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.halfWindowSpinBox) self.numOfErosionsLabel = QtWidgets.QLabel(self.groupbox) self.numOfErosionsLabel.setObjectName("numOfErosionsLabel") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.numOfErosionsLabel) self.numOfErosionsSpinBox = QtWidgets.QSpinBox(self.groupbox) self.numOfErosionsSpinBox.setObjectName("numOfErosionsSpinBox") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.numOfErosionsSpinBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox) self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_2.setObjectName("formLayout_2") self.windowSizeLabel = QtWidgets.QLabel(self.groupbox) self.windowSizeLabel.setObjectName("windowSizeLabel") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.windowSizeLabel) self.windowSizeSpinBox = QtWidgets.QSpinBox(self.groupbox) self.windowSizeSpinBox.setObjectName("windowSizeSpinBox") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.windowSizeSpinBox) self.numOfRangesLabel = QtWidgets.QLabel(self.groupbox) self.numOfRangesLabel.setObjectName("numOfRangesLabel") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.numOfRangesLabel) self.numOfRangesSpinBox = QtWidgets.QSpinBox(self.groupbox) self.numOfRangesSpinBox.setObjectName("numOfRangesSpinBox") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.numOfRangesSpinBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox) self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_2.setObjectName("formLayout_2") self.smoothnessLabel = QtWidgets.QLabel(self.groupbox) self.smoothnessLabel.setObjectName("smoothnessLabel") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.smoothnessLabel) self.smoothnessDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox) self.smoothnessDoubleSpinBox.setObjectName("smoothnessDoubleSpinBox") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.smoothnessDoubleSpinBox) self.dilationLabel = QtWidgets.QLabel(self.groupbox) self.dilationLabel.setObjectName("dilationLabel") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.dilationLabel) self.dilationSpinBox = QtWidgets.QSpinBox(self.groupbox) self.dilationSpinBox.setObjectName("dilationSpinBox") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.dilationSpinBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox) self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_2.setObjectName("formLayout_2") self.windowSizeLabel = QtWidgets.QLabel(self.groupbox) self.windowSizeLabel.setObjectName("windowSizeLabel") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.windowSizeLabel) self.windowSizeSpinBox = QtWidgets.QSpinBox(self.groupbox) self.windowSizeSpinBox.setObjectName("windowSizeSpinBox") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.windowSizeSpinBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def saveSettings(self): lineEdit_filemaskregex = self.findChild(QLineEdit, "lineEdit_filemaskregex") cfg.settings.setValue('Options/FilemaskRegEx', lineEdit_filemaskregex.text()) lineEdit_mediainfo_path = self.findChild(QLineEdit, "lineEdit_mediainfo_path") cfg.settings.setValue('Paths/mediainfo_bin', lineEdit_mediainfo_path.text()) lineEdit_mp3guessenc_path = self.findChild(QLineEdit, "lineEdit_mp3guessenc_path") cfg.settings.setValue('Paths/mp3guessenc_bin', lineEdit_mp3guessenc_path.text()) lineEdit_aucdtect_path = self.findChild(QLineEdit, "lineEdit_aucdtect_path") cfg.settings.setValue('Paths/aucdtect_bin', lineEdit_aucdtect_path.text()) lineEdit_sox_path = self.findChild(QLineEdit, "lineEdit_sox_path") cfg.settings.setValue('Paths/sox_bin', lineEdit_sox_path.text()) lineEdit_ffprobe_path = self.findChild(QLineEdit, "lineEdit_ffprobe_path") cfg.settings.setValue('Paths/ffprobe_bin', lineEdit_ffprobe_path.text()) checkBox_recursive = self.findChild(QCheckBox, "checkBox_recursive") cfg.settings.setValue('Options/RecurseDirectories', checkBox_recursive.isChecked()) checkBox_followsymlinks = self.findChild(QCheckBox, "checkBox_followsymlinks") cfg.settings.setValue('Options/FollowSymlinks', checkBox_followsymlinks.isChecked()) checkBox_cache = self.findChild(QCheckBox, "checkBox_cache") cfg.settings.setValue('Options/UseCache', checkBox_cache.isChecked()) checkBox_cacheraw = self.findChild(QCheckBox, "checkBox_cacheraw") cfg.settings.setValue('Options/CacheRawOutput', checkBox_cacheraw.isChecked()) spinBox_processes = self.findChild(QSpinBox, "spinBox_processes") cfg.settings.setValue('Options/Processes', spinBox_processes.value()) spinBox_spectrogram_palette = self.findChild(QSpinBox, "spinBox_spectrogram_palette") cfg.settings.setValue('Options/SpectrogramPalette', spinBox_spectrogram_palette.value()) checkBox_debug = self.findChild(QCheckBox, "checkBox_debug") cfg.settings.setValue('Options/Debug', checkBox_debug.isChecked()) cfg.debug_enabled = checkBox_debug.isChecked() checkBox_savewindowstate = self.findChild(QCheckBox, "checkBox_savewindowstate") cfg.settings.setValue('Options/SaveWindowState', checkBox_savewindowstate.isChecked()) checkBox_clearfilelist = self.findChild(QCheckBox, "checkBox_clearfilelist") cfg.settings.setValue('Options/ClearFilelist', checkBox_clearfilelist.isChecked()) checkBox_spectrogram = self.findChild(QCheckBox, "checkBox_spectrogram") cfg.settings.setValue('Options/EnableSpectrogram', checkBox_spectrogram.isChecked()) checkBox_bitrate_graph = self.findChild(QCheckBox, "checkBox_bitrate_graph") cfg.settings.setValue('Options/EnableBitGraph', checkBox_bitrate_graph.isChecked()) checkBox_aucdtect_scan = self.findChild(QCheckBox, "checkBox_aucdtect_scan") cfg.settings.setValue('Options/auCDtect_scan', checkBox_aucdtect_scan.isChecked()) horizontalSlider_aucdtect_mode = self.findChild(QSlider, "horizontalSlider_aucdtect_mode") cfg.settings.setValue('Options/auCDtect_mode', horizontalSlider_aucdtect_mode.value()) self.close()
def __init__(self, parent, node): super(LocalNodeWidget, self).__init__(parent) self.setTitle('Local node properties') self._node = node self._node_id_collector = uavcan.app.message_collector.MessageCollector( self._node, uavcan.protocol.NodeStatus, timeout=uavcan.protocol.NodeStatus().OFFLINE_TIMEOUT_MS * 1e-3) self._node_id_label = QLabel('Set local node ID:', self) self._node_id_spinbox = QSpinBox(self) self._node_id_spinbox.setMaximum(NODE_ID_MAX) self._node_id_spinbox.setMinimum(NODE_ID_MIN) self._node_id_spinbox.setValue(NODE_ID_MAX) self._node_id_spinbox.valueChanged.connect(self._update) self._node_id_apply = make_icon_button('check', 'Apply local node ID', self, on_clicked=self._on_node_id_apply_clicked) self._update_timer = QTimer(self) self._update_timer.setSingleShot(False) self._update_timer.timeout.connect(self._update) self._update_timer.start(500) self._update() layout = QHBoxLayout(self) layout.addWidget(self._node_id_label) layout.addWidget(self._node_id_spinbox) layout.addWidget(self._node_id_apply) layout.addStretch(1) self.setLayout(layout) flash(self, 'Some functions will be unavailable unless local node ID is set')
def __init__( self, app ): super().__init__( app, T_('Commit Log History') ) if self.app is None: self.prefs = None else: self.prefs = self.app.prefs.log_history self.default_limit = QtWidgets.QSpinBox() self.default_limit.setRange( 1, 100000 ) self.default_limit.setSuffix( T_(' Commits') ) self.use_default_limit = QtWidgets.QCheckBox( T_('Use limit') ) self.default_until = QtWidgets.QSpinBox() self.default_until.setRange( 1, 365 ) self.default_until.setSuffix( T_(' days') ) self.use_default_until = QtWidgets.QCheckBox( T_('Use until') ) self.default_since = QtWidgets.QSpinBox() self.default_since.setRange( 2, 365 ) self.default_since.setSuffix( T_(' days') ) self.use_default_since = QtWidgets.QCheckBox( T_('Use since') ) if self.prefs is not None: self.default_limit.setValue( self.prefs.default_limit ) self.use_default_limit.setChecked( self.prefs.use_default_limit ) self.default_until.setValue( self.prefs.default_until_days_interval ) self.use_default_until.setChecked( self.prefs.use_default_until_days_interval ) self.default_since.setValue( self.prefs.default_since_days_interval ) self.use_default_since.setChecked( self.prefs.use_default_since_days_interval ) self.addRow( T_('Default Limit'), self.default_limit, self.use_default_limit ) self.addRow( T_('Default until interval'), self.default_until, self.use_default_until ) self.addRow( T_('Default since interval'), self.default_since, self.use_default_since ) self.default_until.valueChanged.connect( self.__untilChanged )
def __init__(self, option, value): super().__init__(option) if isinstance(value, float): self.number = QW.QDoubleSpinBox() else: self.number = QW.QSpinBox() self.number.setRange(-1000000, 1000000) self.number.setValue(value) self.number.installEventFilter(self) self.layout.addWidget(self.number)
def read_settings(self): settings = QtCore.QSettings(self._application, self._section) for key in settings.allKeys(): value = settings.value(key) try: # This is required to skip the tab_position key/value this = getattr(self.ui, key) except: continue if isinstance(this, QW.QLineEdit): this.setText(value) elif isinstance(this, QW.QSpinBox): this.setValue(int(value)) elif isinstance(this, QW.QComboBox): index = this.findText(value) this.setCurrentIndex(index) elif isinstance(this, QW.QCheckBox): if value in ['false']: this.setChecked(False) else: this.setChecked(True) else: print('could not handle : %s' % this) # The last tab position self._tab_pos = settings.value("tab_position", 0, type=int) self.ui.tabs.setCurrentIndex(self._tab_pos)
def setupUi(self, ScientificScroller): ScientificScroller.setObjectName("ScientificScroller") ScientificScroller.resize(283, 61) self.horizontalLayout = QtWidgets.QHBoxLayout(ScientificScroller) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setSpacing(3) self.horizontalLayout.setObjectName("horizontalLayout") self.mantissa = QDoubleSpinBoxDotSeparator(ScientificScroller) self.mantissa.setSpecialValueText("") self.mantissa.setDecimals(4) self.mantissa.setMinimum(-1000.0) self.mantissa.setMaximum(1000.0) self.mantissa.setSingleStep(0.01) self.mantissa.setObjectName("mantissa") self.horizontalLayout.addWidget(self.mantissa) self.label = QtWidgets.QLabel(ScientificScroller) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.exponent = QtWidgets.QSpinBox(ScientificScroller) self.exponent.setMinimum(-99) self.exponent.setObjectName("exponent") self.horizontalLayout.addWidget(self.exponent) self.horizontalLayout.setStretch(0, 1) self.retranslateUi(ScientificScroller) QtCore.QMetaObject.connectSlotsByName(ScientificScroller)
def __init__(self, parent=None): super().__init__(parent) s = plexdesktop.settings.Settings() self.setWindowTitle('Preferences') self.form = QtWidgets.QFormLayout(self) i = QtWidgets.QComboBox() i.addItems(plexdesktop.style.Style.Instance().themes) i.setCurrentIndex(i.findText(s.value('theme'))) self.form.addRow(QtWidgets.QLabel('theme'), i) bf = QtWidgets.QSpinBox() bf.setValue(int(s.value('browser_font', 9))) self.form.addRow(QtWidgets.QLabel('browser font size'), bf) icon_size = QtWidgets.QLineEdit(str(s.value('thumb_size', 240))) icon_size.setValidator(QtGui.QIntValidator(0, 300)) self.form.addRow(QtWidgets.QLabel('thumbnail size'), icon_size) widget_player = QtWidgets.QCheckBox() widget_player.setCheckState(QtCore.Qt.Checked if bool(int(s.value('widget_player', 0))) else QtCore.Qt.Unchecked) self.form.addRow(QtWidgets.QLabel('use widget player'), widget_player) self.buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self) self.form.addRow(self.buttons) self.buttons.rejected.connect(self.reject) self.buttons.accepted.connect(self.accept) if self.exec_() == QtWidgets.QDialog.Accepted: # s = Settings() theme = i.currentText() s.setValue('theme', theme) plexdesktop.style.Style.Instance().theme(theme) s.setValue('browser_font', bf.value()) s.setValue('thumb_size', int(icon_size.text())) s.setValue('widget_player', 1 if widget_player.checkState() == QtCore.Qt.Checked else 0)
def getValue(self): """ @return: the current value of the QSpinBox """ return self.spinbox.value()
def getValue(self): """ @return: the current value of the QSpinBox """ return str(self.lineedit.text())
def getValue(self): """ @return the current value of the QSpinBox (string list) """ item_list = str(self.lineedit.text()).split(self.separator) i = 0 while i < len(item_list): item_list[i] = item_list[i].strip(' ') #remove leading and trailing whitespaces i += 1 return item_list
def setCellValue(self, line, column, value): """ This function is reimplemented to use QTextEdit into the table, thus allowing multi-lines custom GCODE to be stored @param line: line number (int) @param column: column number (int) @param value: cell content (string or int or float) """ if column > 0: #we use QDoubleSpinBox for storing the values spinbox = CorrectedDoubleSpinBox() spinbox.setMinimum(0) spinbox.setMaximum(1000000000) #Default value is 99 computed_value = 0.0 try: computed_value = float(value) #Convert the value to float except ValueError: pass spinbox.setValue(computed_value) else: #tool number is an integer spinbox = QSpinBox() spinbox.setMinimum(0) spinbox.setMaximum(1000000000) #Default value is 99 computed_value = 0 try: computed_value = int(value) #Convert the value to int (we may receive a string for example) except ValueError: computed_value = self.max_tool_number + 1 self.max_tool_number = max(self.max_tool_number, computed_value) #Store the max value for the tool number, so that we can automatically increment this value for new tools spinbox.setValue(computed_value) #first column is the key, it must be an int self.tablewidget.setCellWidget(line, column, spinbox)
def __init__(self, id_, name="", quantity=0): super().__init__() self.id_ = id_ self.input = QtWidgets.QLineEdit() self.quantity_input = QtWidgets.QSpinBox() self.quantity_input.setRange(0, 9999) self.quantity_input.setValue(quantity) self.quantity_input.setSuffix(" mL") self.input.setText(name) self.button = QtWidgets.QPushButton("Supprimer") self.button.clicked.connect(self.remove) self.layout = QtWidgets.QHBoxLayout(self) self.layout.addWidget(self.input) self.layout.addWidget(self.quantity_input) self.layout.addWidget(self.button)
def eventFilter(self, obje, even): if type(even) == QtGui.QWheelEvent: if type(obje) == QtWidgets.QSpinBox: if not obje.hasFocus(): even.ignore() return True try: return obje.eventFilter(obje, even) except: return False
def apply_changes_impl(self): for i in Qualification: name = i.name if i in self.group.ranking.rank: rank = self.group.ranking.rank[i] assert isinstance(rank, RankingItem) rank.is_active = self.findChild(QCheckBox, name + '_checkbox').isChecked() rank.max_place = self.findChild(QSpinBox, name + '_place').value() rank.max_time = time_to_otime(self.findChild(QTimeEdit, name + '_time').time()) rank.use_scores = self.findChild(AdvComboBox, name + '_combo').currentText() == _('Rank') ResultCalculation().set_rank(self.group)
def setupUi(self, AutoSelectSetting): AutoSelectSetting.setObjectName("AutoSelectSetting") AutoSelectSetting.resize(386, 219) self.buttonBoxQuery = QtWidgets.QDialogButtonBox(AutoSelectSetting) self.buttonBoxQuery.setGeometry(QtCore.QRect(20, 181, 341, 31)) self.buttonBoxQuery.setOrientation(QtCore.Qt.Horizontal) self.buttonBoxQuery.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBoxQuery.setObjectName("buttonBoxQuery") self.gridLayoutWidget = QtWidgets.QWidget(AutoSelectSetting) self.gridLayoutWidget.setGeometry(QtCore.QRect(20, 40, 160, 81)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setObjectName("gridLayout") self.spinBox = QtWidgets.QSpinBox(self.gridLayoutWidget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(15) sizePolicy.setHeightForWidth(self.spinBox.sizePolicy().hasHeightForWidth()) self.spinBox.setSizePolicy(sizePolicy) self.spinBox.setProperty("value", 1) self.spinBox.setObjectName("spinBox") self.gridLayout.addWidget(self.spinBox, 1, 0, 1, 1) self.label = QtWidgets.QLabel(self.gridLayoutWidget) font = QtGui.QFont() font.setPointSize(14) font.setBold(True) font.setItalic(True) font.setWeight(75) self.label.setFont(font) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.retranslateUi(AutoSelectSetting) self.buttonBoxQuery.accepted.connect(AutoSelectSetting.accept) self.buttonBoxQuery.rejected.connect(AutoSelectSetting.reject) QtCore.QMetaObject.connectSlotsByName(AutoSelectSetting)
def createEditor(self, parent, option, index): editor = QSpinBox(parent) editor.setMinimum(0) editor.setMaximum(100) return editor
def setupUi(self, SettingsDialog): SettingsDialog.setObjectName("SettingsDialog") SettingsDialog.resize(459, 141) self.gridLayout_2 = QtWidgets.QGridLayout(SettingsDialog) self.gridLayout_2.setObjectName("gridLayout_2") self.comboBox = QtWidgets.QComboBox(SettingsDialog) self.comboBox.setObjectName("comboBox") self.gridLayout_2.addWidget(self.comboBox, 0, 1, 1, 1) self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setContentsMargins(0, -1, -1, -1) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(SettingsDialog) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) self.buttonBox = QtWidgets.QDialogButtonBox(SettingsDialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridLayout_2.addWidget(self.buttonBox, 2, 0, 1, 2) self.label_2 = QtWidgets.QLabel(SettingsDialog) self.label_2.setObjectName("label_2") self.gridLayout_2.addWidget(self.label_2, 1, 0, 1, 1) self.spinBox = QtWidgets.QSpinBox(SettingsDialog) self.spinBox.setObjectName("spinBox") self.gridLayout_2.addWidget(self.spinBox, 1, 1, 1, 1) self.retranslateUi(SettingsDialog) self.buttonBox.accepted.connect(SettingsDialog.accept) self.buttonBox.rejected.connect(SettingsDialog.reject) QtCore.QMetaObject.connectSlotsByName(SettingsDialog)
def __init__(self): super().__init__() self.setFrameShape(QtWidgets.QFrame.Box) self.setFrameShadow(QtWidgets.QFrame.Sunken) self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self) self.horizontalLayout_3.setContentsMargins(3, 0, 3, 0) self.horizontalLayout_3.setSpacing(0) self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.upbeatSpinBox = QtWidgets.QSpinBox(self) self.upbeatSpinBox.setPrefix("") self.upbeatSpinBox.setMinimum(0) self.upbeatSpinBox.setMaximum(999999999) self.upbeatSpinBox.setObjectName("upbeatSpinBox") self.horizontalLayout_3.addWidget(self.upbeatSpinBox) self.callTickWidget = QtWidgets.QPushButton(self) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.callTickWidget.sizePolicy().hasHeightForWidth()) self.callTickWidget.setSizePolicy(sizePolicy) self.callTickWidget.setMaximumSize(QtCore.QSize(25, 16777215)) self.callTickWidget.setFlat(False) self.callTickWidget.setObjectName("callTickWidget") self.callTickWidget.setText("?? ") self.horizontalLayout_3.addWidget(self.callTickWidget) self.callTickWidget.clicked.connect(self.callClickWidgetForUpbeat) self.setFocusPolicy(0) #no focus self.callTickWidget.setFocusPolicy(0) #no focus self.valueChanged = self.upbeatSpinBox.valueChanged
def __init__(self, mainWindow, staticExportTempoItem = None): super().__init__(mainWindow, "choose units per minute, reference note, graph type") self.mainWindow = mainWindow self.staticExportTempoItem = staticExportTempoItem tickindex, unitsPerMinute, referenceTicks, graphType = self.getCurrentValues() #takes self.staticExportTempoItem into account self.unitbox = QtWidgets.QSpinBox() self.unitbox.setMinimum(1) self.unitbox.setMaximum(999) self.unitbox.setValue(unitsPerMinute) self.layout.addWidget(self.unitbox) self.referenceList = QtWidgets.QComboBox() self.referenceList.addItems(constantsAndConfigs.prettyExtendedRhythmsStrings) self.referenceList.setCurrentIndex(constantsAndConfigs.prettyExtendedRhythmsValues.index(referenceTicks)) self.layout.addWidget(self.referenceList) self.interpolationList = QtWidgets.QComboBox() l = api.getListOfGraphInterpolationTypesAsStrings() self.interpolationList.addItems(l) self.interpolationList.setCurrentIndex(l.index(graphType)) self.layout.addWidget(self.interpolationList) self.__call__()
def makeValueWidget(self, value): types = { str : QtWidgets.QLineEdit, int : QtWidgets.QSpinBox, float : QtWidgets.QDoubleSpinBox, } typ = type(value) widget = types[typ]() if typ == str: widget.setText(value) elif typ == int or typ == float: widget.setValue(value) return widget
def __init__(self, mainWindow): super().__init__(mainWindow, "Channel Change 0-15. [enter] to use value") self.spinbox = QtWidgets.QSpinBox() self.spinbox.setValue(type(self).lastCustomValue) self.spinbox.setMinimum(0) self.spinbox.setMaximum(15) self.spinbox.setSingleStep(1) self.layout.addRow("Channel", self.spinbox) self.name = QtWidgets.QLineEdit() self.layout.addRow("Text", self.name)
def createEditor(self, parent, styleOption, index): if index.column() == 0: editor = QLineEdit(parent) editor.setReadOnly(True) return editor editor = QSpinBox(parent) return editor
def setEditorData(self, editor, index): if isinstance(editor, QLineEdit): editor.setText(index.model().data(index, Qt.DisplayRole)) elif isinstance(editor, QSpinBox): value = int(index.model().data(index, Qt.EditRole)) editor.setValue(value)
def setModelData(self, editor, model, index): if isinstance(editor, QLineEdit): model.setData(index, editor.text()) elif isinstance(editor, QSpinBox): model.setData(index, editor.value())
def __init__(self, parent): super().__init__('Font', parent) self.font_name_edit = QtWidgets.QComboBox( self, editable=False, sizePolicy=QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred), insertPolicy=QtWidgets.QComboBox.NoInsert) self.font_size_edit = QtWidgets.QSpinBox(self, minimum=0) self.bold_checkbox = QtWidgets.QCheckBox('Bold', self) self.italic_checkbox = QtWidgets.QCheckBox('Italic', self) self.underline_checkbox = QtWidgets.QCheckBox('Underline', self) self.strike_out_checkbox = QtWidgets.QCheckBox('Strike-out', self) all_fonts = QtGui.QFontDatabase().families() self.font_name_edit.addItems(all_fonts) layout = QtWidgets.QGridLayout(self) layout.setColumnStretch(0, 1) layout.setColumnStretch(1, 2) layout.addWidget(QtWidgets.QLabel('Name:', self), 0, 0) layout.addWidget(self.font_name_edit, 0, 1) layout.addWidget(QtWidgets.QLabel('Size:', self), 1, 0) layout.addWidget(self.font_size_edit, 1, 1) layout.addWidget(QtWidgets.QLabel('Style:', self), 2, 0) layout.addWidget(self.bold_checkbox, 2, 1) layout.addWidget(self.italic_checkbox, 3, 1) layout.addWidget(self.underline_checkbox, 4, 1) layout.addWidget(self.strike_out_checkbox, 5, 1)
def __init__(self, parent=None): super().__init__(parent) self.start_time_edit = bubblesub.ui.util.TimeEdit(self) self.end_time_edit = bubblesub.ui.util.TimeEdit(self) self.duration_edit = bubblesub.ui.util.TimeEdit(self) self.margins_widget = QtWidgets.QWidget(self) self.margin_l_edit = QtWidgets.QSpinBox( self.margins_widget, minimum=0, maximum=999) self.margin_v_edit = QtWidgets.QSpinBox( self.margins_widget, minimum=0, maximum=999) self.margin_r_edit = QtWidgets.QSpinBox( self.margins_widget, minimum=0, maximum=999) layout = QtWidgets.QHBoxLayout(self.margins_widget, spacing=0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.margin_l_edit) layout.addWidget(self.margin_v_edit) layout.addWidget(self.margin_r_edit) self.layer_edit = QtWidgets.QSpinBox(self, minimum=0) layout = QtWidgets.QHBoxLayout(self) layout.setSpacing(12) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(QtWidgets.QLabel('Start time:', self)) layout.addWidget(self.start_time_edit) layout.addWidget(QtWidgets.QLabel('End time:', self)) layout.addWidget(self.end_time_edit) layout.addWidget(QtWidgets.QLabel('Duration:', self)) layout.addWidget(self.duration_edit) layout.addStretch() layout.addWidget(QtWidgets.QLabel('Margins:', self)) layout.addWidget(self.margins_widget) layout.addWidget(QtWidgets.QLabel('Layer:', self)) layout.addWidget(self.layer_edit)
def setUp(self, ui): super().setUp(ui) self.spinbox = QSpinBox(self) self.spinbox.setSingleStep(self.parameter.step) if self.parameter.range is not None: min_, max_ = self.parameter.range self.spinbox.setMinimum(min_) self.spinbox.setMaximum(max_) self.spinbox.setValue(self.value) self.spinbox.valueChanged.connect(self.on_spinbox_valueChanged) self.layout.addWidget(self.spinbox)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox) self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_2.setObjectName("formLayout_2") self.orderLabel = QtWidgets.QLabel(self.groupbox) self.orderLabel.setObjectName("orderLabel") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.orderLabel) self.orderSpinBox = QtWidgets.QSpinBox(self.groupbox) self.orderSpinBox.setObjectName("orderSpinBox") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.orderSpinBox) self.numOfStandardDeviationsLabel = QtWidgets.QLabel(self.groupbox) self.numOfStandardDeviationsLabel.setObjectName("numOfStandardDeviationsLabel") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.numOfStandardDeviationsLabel) self.numOfStandardDeviationsSpinBox = QtWidgets.QSpinBox(self.groupbox) self.numOfStandardDeviationsSpinBox.setObjectName("numOfStandardDeviationsSpinBox") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.numOfStandardDeviationsSpinBox) self.maxNumOfIterationsLabel = QtWidgets.QLabel(self.groupbox) self.maxNumOfIterationsLabel.setObjectName("maxNumOfIterationsLabel") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.maxNumOfIterationsLabel) self.maxNumOfIterationsSpinBox = QtWidgets.QSpinBox(self.groupbox) self.maxNumOfIterationsSpinBox.setObjectName("maxNumOfIterationsSpinBox") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.maxNumOfIterationsSpinBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout = QtWidgets.QFormLayout(self.groupbox) self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setObjectName("formLayout") self.asymmetryLabel = QtWidgets.QLabel(self.groupbox) self.asymmetryLabel.setObjectName("asymmetryLabel") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.asymmetryLabel) self.asymmetryDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox) self.asymmetryDoubleSpinBox.setObjectName("asymmetryDoubleSpinBox") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.asymmetryDoubleSpinBox) self.smoothnessLabel = QtWidgets.QLabel(self.groupbox) self.smoothnessLabel.setObjectName("smoothnessLabel") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.smoothnessLabel) self.smoothnessDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox) self.smoothnessDoubleSpinBox.setObjectName("smoothnessDoubleSpinBox") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.smoothnessDoubleSpinBox) self.maxNumOfIterationsLabel = QtWidgets.QLabel(self.groupbox) self.maxNumOfIterationsLabel.setObjectName("maxNumOfIterationsLabel") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.maxNumOfIterationsLabel) self.maxNumOfIterationsSpinBox = QtWidgets.QSpinBox(self.groupbox) self.maxNumOfIterationsSpinBox.setObjectName("maxNumOfIterationsSpinBox") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.maxNumOfIterationsSpinBox) self.convergenceThresholdLabel = QtWidgets.QLabel(self.groupbox) self.convergenceThresholdLabel.setObjectName("convergenceThresholdLabel") self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.convergenceThresholdLabel) self.convergenceThresholdDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox) self.convergenceThresholdDoubleSpinBox.setObjectName("convergenceThresholdDoubleSpinBox") self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.convergenceThresholdDoubleSpinBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupBox = QtWidgets.QGroupBox(Form) self.groupBox.setObjectName("groupBox") self.formLayout = QtWidgets.QFormLayout(self.groupBox) self.formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setObjectName("formLayout") self.n_est_label = QtWidgets.QLabel(self.groupBox) self.n_est_label.setObjectName("n_est_label") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.n_est_label) self.n_est_spin = QtWidgets.QSpinBox(self.groupBox) self.n_est_spin.setObjectName("n_est_spin") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.n_est_spin) self.prop_outliers_label = QtWidgets.QLabel(self.groupBox) self.prop_outliers_label.setToolTip("") self.prop_outliers_label.setObjectName("prop_outliers_label") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.prop_outliers_label) self.prop_outliers_spin = QtWidgets.QDoubleSpinBox(self.groupBox) self.prop_outliers_spin.setDecimals(4) self.prop_outliers_spin.setMaximum(0.5) self.prop_outliers_spin.setObjectName("prop_outliers_spin") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.prop_outliers_spin) self.verticalLayout.addWidget(self.groupBox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox) self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_2.setObjectName("formLayout_2") self.polynomialOrderLabel = QtWidgets.QLabel(self.groupbox) self.polynomialOrderLabel.setObjectName("polynomialOrderLabel") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.polynomialOrderLabel) self.polynomialOrderSpinBox = QtWidgets.QSpinBox(self.groupbox) self.polynomialOrderSpinBox.setObjectName("polynomialOrderSpinBox") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.polynomialOrderSpinBox) self.maximumNumOfIterationsLabel = QtWidgets.QLabel(self.groupbox) self.maximumNumOfIterationsLabel.setObjectName("maximumNumOfIterationsLabel") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.maximumNumOfIterationsLabel) self.maximumNumOfIterationsDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox) self.maximumNumOfIterationsDoubleSpinBox.setObjectName("maximumNumOfIterationsDoubleSpinBox") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.maximumNumOfIterationsDoubleSpinBox) self.toleranceLabel = QtWidgets.QLabel(self.groupbox) self.toleranceLabel.setObjectName("toleranceLabel") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.toleranceLabel) self.toleranceDoubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupbox) self.toleranceDoubleSpinBox.setObjectName("toleranceDoubleSpinBox") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.toleranceDoubleSpinBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Form): Form.setObjectName("Form") self.verticalLayout = QtWidgets.QVBoxLayout(Form) self.verticalLayout.setObjectName("verticalLayout") self.groupbox = QtWidgets.QGroupBox(Form) self.groupbox.setObjectName("groupbox") self.formLayout_2 = QtWidgets.QFormLayout(self.groupbox) self.formLayout_2.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_2.setObjectName("formLayout_2") self.topWidthLabel = QtWidgets.QLabel(self.groupbox) self.topWidthLabel.setObjectName("topWidthLabel") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.topWidthLabel) self.topWidthSpinBox = QtWidgets.QSpinBox(self.groupbox) self.topWidthSpinBox.setObjectName("topWidthSpinBox") self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.topWidthSpinBox) self.bottomWidthLabel = QtWidgets.QLabel(self.groupbox) self.bottomWidthLabel.setObjectName("bottomWidthLabel") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.bottomWidthLabel) self.bottomWidthSpinBox = QtWidgets.QSpinBox(self.groupbox) self.bottomWidthSpinBox.setObjectName("bottomWidthSpinBox") self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.bottomWidthSpinBox) self.exponentLabel = QtWidgets.QLabel(self.groupbox) self.exponentLabel.setObjectName("exponentLabel") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.exponentLabel) self.exponentSpinBox = QtWidgets.QSpinBox(self.groupbox) self.exponentSpinBox.setObjectName("exponentSpinBox") self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.exponentSpinBox) self.tangentLabel = QtWidgets.QLabel(self.groupbox) self.tangentLabel.setObjectName("tangentLabel") self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.tangentLabel) self.tangentCheckBox = QtWidgets.QCheckBox(self.groupbox) self.tangentCheckBox.setObjectName("tangentCheckBox") self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.tangentCheckBox) self.verticalLayout.addWidget(self.groupbox) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex): editor = QSpinBox(parent) editor.setMinimum(self.minimum) editor.setMaximum(self.maximum) editor.valueChanged.connect(self.valueChanged) return editor