qt_binder.widgets¶
Value-added wrappers for Qt widgets.
-
class
qt_binder.widgets.TextField(*args, **traits)[source]¶ Bases:
qt_binder.raw_widgets.LineEditSimple customization of a LineEdit.
The widget can be configured to update the model on every text change or only when Enter is pressed (or focus leaves). This emulates Traits UI’s
TextEditorauto_setandenter_setconfigurations.If a validator is set, invalid text will cause the background to be red.
-
value= Unicode(comparison_mode=NO_COMPARE)¶ The value to sync with the model.
-
mode= Enum('auto', 'enter')¶ Whether the
valueupdates on every keypress, or when Enter is pressed (orfocusOut).
-
valid= QtDynamicProperty(True)¶ Whether or not the current value is valid, for the stylesheet.
-
-
class
qt_binder.widgets.EditableComboBox(*args, **traits)[source]¶ Bases:
qt_binder.raw_widgets.ComboBoxComboBox with an editable text field.
We do not do bidirectional synchronization of the value with the model since that is typically not required for these use cases.
-
value= Any(Undefined, comparison_mode=NO_COMPARE)¶ The selected value.
-
values= List(Tuple(Any, Unicode))¶ (object, label) pairs.
-
same_as= Callable(operator.eq)¶ Function that is used to compare two objects in the values list for equality. Defaults to normal Python equality.
-
-
class
qt_binder.widgets.EnumDropDown(*args, **traits)[source]¶ Bases:
qt_binder.raw_widgets.ComboBoxSelect from a set of preloaded choices.
-
value= Any(Undefined, comparison_mode=NO_COMPARE)¶ The selected value.
-
values= List(Tuple(Any, Unicode))¶ (object, label) pairs.
-
same_as= Callable(operator.eq)¶ Function that is used to compare two objects in the values list for equality. Defaults to normal Python equality.
-
-
class
qt_binder.widgets.UIFile(filename, **traits)[source]¶ Bases:
qt_binder.binder.CompositeLoad a layout from a Qt Designer
.uifile.Widgets and layouts with names that do not start with underscores will be added as traits to this
Binder. Thebinder_registrywill be consulted to find the rawBinderto use for each widget. This can be overridden for any named widget using theoverridestrait.In case one wants to let the
Binderto own its widget but just use the.uifile for layout, use theinsertionsdictionary. The named widget should be a plainQWidgetin the UI laid out as desired. TheBinderwill create a new widget as the lone child of this widget and take up all of its space.-
qclass¶
-
filename= Str()¶ The .ui file with the layout.
-
overrides= Dict(Str, Instance(Binder))¶ Override binders for named widgets.
-
insertions= Dict(Str, Instance(Binder))¶ Insert binders as children of the named QWidgets.
-
-
class
qt_binder.widgets.BaseSlider(*args, **traits)[source]¶ Bases:
qt_binder.raw_widgets.SliderBase class for the other sliders.
Mostly for interface-checking and common defaults.
-
value= Any(0)¶ The value to synch with the model.
-
range= Tuple(Any(0), Any(99))¶ The inclusive range.
-
qt_value= Rename('value')¶ The underlying Qt value.
-
orientation= Default(<DocMock.Unknown>)¶
-
-
class
qt_binder.widgets.IntSlider(*args, **traits)[source]¶ Bases:
qt_binder.widgets.BaseSlider-
value= Int(0)¶ The value to synch with the model.
-
range= Tuple(Int(0), Int(99))¶ The inclusive range.
-
-
class
qt_binder.widgets.FloatSlider(*args, **traits)[source]¶ Bases:
qt_binder.widgets.BaseSlider-
value= Float(0.0)¶ The value to synch with the model.
-
range= Tuple(Float(0.0), Float(1.0))¶ The inclusive range.
-
precision= Int(1000)¶ The number of steps in the range.
-
-
class
qt_binder.widgets.LogSlider(*args, **traits)[source]¶ Bases:
qt_binder.widgets.FloatSlider-
range= Tuple(Float(0.01), Float(100.0))¶ The inclusive range.
-
-
class
qt_binder.widgets.RangeSlider(*args, **traits)[source]¶ Bases:
qt_binder.binder.CompositeA slider with labels and a text entry field.
The root widget is a
QWidgetwith a new propertybinder_class=RangeSlider. Stylesheets can reference it using the selector:*[binder_class="RangeSlider"] {...}This can be useful for styling the child
QLabelsandQLineEdit, for example to make a series ofRangeSlidersalign.-
qclass¶
-
value= Any(0)¶ The value to synch with the model.
-
range= Tuple(Any(0), Any(99))¶ The inclusive range.
-
label_format_func= Callable(six.text_type)¶ The formatting function for the labels.
-
field_format_func= Callable(six.text_type)¶ The formatting function for the text field. This is used only when the slider is setting the value.
-
field= Instance(TextField, args=())¶ The field widget.
-
slider= Instance(BaseSlider, factory=IntSlider, args=())¶ The slider widget.
-