add completer to general fit linedit
This commit is contained in:
parent
53c58b2bbb
commit
5e55f06723
@ -19,8 +19,6 @@ class FitModelWidget(QtWidgets.QWidget, Ui_FitParameter):
|
||||
|
||||
self.parametername.setText(label + ' ')
|
||||
|
||||
# validator = QtGui.QDoubleValidator()
|
||||
# validator.setDecimals(9)
|
||||
# self.parameter_line.setValidator(validator)
|
||||
self.parameter_line.setText('1')
|
||||
self.parameter_line.setMaximumWidth(60)
|
||||
@ -38,15 +36,21 @@ class FitModelWidget(QtWidgets.QWidget, Ui_FitParameter):
|
||||
if fixed:
|
||||
self.fixed_check.hide()
|
||||
|
||||
self.menu = QtWidgets.QMenu(self)
|
||||
self.add_links()
|
||||
|
||||
self.is_linked = None
|
||||
self.parameter_pos = None
|
||||
self.func_idx = None
|
||||
|
||||
self._linetext = '1'
|
||||
|
||||
self.completer = QtWidgets.QCompleter()
|
||||
self.completer.setCompletionMode(QtWidgets.QCompleter.UnfilteredPopupCompletion)
|
||||
self.parameter_hint_model = QtGui.QStandardItemModel()
|
||||
self.completer.setModel(self.parameter_hint_model)
|
||||
self.parameter_line.setCompleter(self.completer)
|
||||
|
||||
self.menu = QtWidgets.QMenu(self)
|
||||
self.add_links()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
return convert(self.parametername.text().strip(), old='html', new='str')
|
||||
@ -130,16 +134,25 @@ class FitModelWidget(QtWidgets.QWidget, Ui_FitParameter):
|
||||
parameter = {}
|
||||
self.menu.clear()
|
||||
|
||||
self.parameter_hint_model.clear()
|
||||
|
||||
ac = QtWidgets.QAction('Link to...', self)
|
||||
ac.triggered.connect(self.link_parameter)
|
||||
self.menu.addAction(ac)
|
||||
|
||||
for model_key, model_funcs in parameter.items():
|
||||
m = QtWidgets.QMenu('Model ' + model_key, self)
|
||||
hint_key = model_key
|
||||
|
||||
for func_name, func_params in model_funcs.items():
|
||||
m2 = QtWidgets.QMenu(func_name, m)
|
||||
hint_key += f'.{func_name}'
|
||||
for p_name, idx in func_params:
|
||||
ac = QtWidgets.QAction(p_name, m2)
|
||||
hint_key += f'.{p_name}'
|
||||
item = QtGui.QStandardItem(hint_key)
|
||||
item.setData((model_key, *idx))
|
||||
self.parameter_hint_model.appendRow(item)
|
||||
ac.setData((model_key, *idx))
|
||||
ac.triggered.connect(self.link_parameter)
|
||||
m2.addAction(ac)
|
||||
|
@ -339,7 +339,7 @@ class ParameterSingleWidget(QtWidgets.QWidget):
|
||||
# self.value_line.setText(f'{float(val):.5g}')
|
||||
self.value_line.setText(f'{val}')
|
||||
|
||||
def show_as_local_parameter(self, is_local):
|
||||
def show_as_local_parameter(self, is_local: bool):
|
||||
if is_local:
|
||||
self.label.setStyleSheet('font-weight: bold;')
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user