qt_binder.widgets
¶
Value-added wrappers for Qt widgets.
-
class
qt_binder.widgets.
TextField
(*args, **traits)[source]¶ Bases:
qt_binder.raw_widgets.LineEdit
Simple 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
TextEditor
auto_set
andenter_set
configurations.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
value
updates 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.ComboBox
ComboBox 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.ComboBox
Select 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.Composite
Load a layout from a Qt Designer
.ui
file.Widgets and layouts with names that do not start with underscores will be added as traits to this
Binder
. Thebinder_registry
will be consulted to find the rawBinder
to use for each widget. This can be overridden for any named widget using theoverrides
trait.-
qclass
¶
-
filename
= Str()¶ The .ui file with the layout.
-
overrides
= Dict(Str, Instance(Binder))¶ Override binders for named widgets.
-
-
class
qt_binder.widgets.
BaseSlider
(*args, **traits)[source]¶ Bases:
qt_binder.raw_widgets.Slider
Base 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.
-
configure
()¶
-
-
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.
-
configure
()¶
-
-
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.Composite
A slider with labels and a text entry field.
The root widget is a
QWidget
with a new propertybinder_class=RangeSlider
. Stylesheets can reference it using the selector:*[binder_class="RangeSlider"] {...}
This can be useful for styling the child
QLabels
andQLineEdit
, for example to make a series ofRangeSliders
align.-
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.
-