madgui.widget.tableview module¶
Table widget specified by column behaviour.
Classes
|
Cell item data for a tree widget. |
|
Table data model. |
|
A table widget based on Qt’s QTableView for our |
|
A tree widget based on Qt’s QTableView for our |
|
Descriptor/type information for a TreeNode. |
|
Proxy class for accessing contents/properties of a table cell. |
|
|
|
Wrap a value of a specific type for string rendering and editting. |
|
Bare string value. |
|
Integer value. |
|
Boolean value. |
|
|
|
|
|
List value. |
|
|
|
Single-line edit control with prefix/suffix text. |
Functions
|
-
class
madgui.widget.tableview.
AffixLineEdit
(*args, **kwargs)[source]¶ Bases:
PyQt5.QtWidgets.QWidget
Single-line edit control with prefix/suffix text.
Methods
focusInEvent
(self, QFocusEvent)
-
class
madgui.widget.tableview.
BoolDelegate
(*, default=None, fmtspec=None)[source]¶ Bases:
madgui.widget.tableview.ItemDelegate
Boolean value.
Attributes
bool(x) -> bool
-
default
= False¶
-
-
class
madgui.widget.tableview.
EnumDelegate
(*, default=None, fmtspec=None)[source]¶ Bases:
madgui.widget.tableview.StringDelegate
Methods
createEditor
(self, QWidget, …)setEditorData
(self, QWidget, QModelIndex)setModelData
(self, QWidget, …)
-
class
madgui.widget.tableview.
ExpressionDelegate
(unit=None)[source]¶ Bases:
madgui.widget.tableview.QuantityDelegate
Methods
createEditor
(self, QWidget, …)edit
(cell)setEditorData
(self, QWidget, QModelIndex)setModelData
(self, QWidget, …)Attributes
str(object=’’) -> str
Qt.Alignment()
-
default
= ''¶
-
textAlignment
= <PyQt5.QtCore.Qt.Alignment object>¶
-
-
class
madgui.widget.tableview.
IntDelegate
(*, default=None, fmtspec=None)[source]¶ Bases:
madgui.widget.tableview.ItemDelegate
Integer value.
Methods
createEditor
(self, QWidget, …)setEditorData
(self, QWidget, QModelIndex)setModelData
(self, QWidget, …)Attributes
int(x=0) -> integer
Qt.Alignment()
-
default
= 0¶
-
textAlignment
= <PyQt5.QtCore.Qt.Alignment object>¶
-
-
class
madgui.widget.tableview.
ItemDelegate
(*, default=None, fmtspec=None)[source]¶ Bases:
PyQt5.QtWidgets.QStyledItemDelegate
Wrap a value of a specific type for string rendering and editting.
Attributes
str(object=’’) -> str
str(object=’’) -> str
Qt.Alignment()
Methods
display
(value)Render the value as string.
edit
(cell)-
default
= ''¶
-
fmtspec
= ''¶
-
textAlignment
= <PyQt5.QtCore.Qt.Alignment object>¶
-
-
class
madgui.widget.tableview.
ItemView
(parent=None, **kwargs)[source]¶ Bases:
object
Mixin class for shared code of
TableView
andTreeView
. Do not use directly.Attributes
bool(x) -> bool
List-like access to the data.
Signal<>
Methods
connectClearButton
(button)connectRemoveButton
(button)keyPressEvent
(event)resizeEvent
(event)Resize all sections to content and user interactive
selectionChanged
(selected, deselected)set_viewmodel
(rowitems[, data, unit, titles])sizeHint
()sizeHintForColumn
(column)-
allow_delete
= False¶
-
property
rows
¶ List-like access to the data.
-
selectionChangedSignal
¶ Signal<>
-
-
class
madgui.widget.tableview.
ItemViewDelegate
[source]¶ Bases:
PyQt5.QtWidgets.QStyledItemDelegate
Methods
createEditor
(self, QWidget, …)delegate
(index)setEditorData
(self, QWidget, QModelIndex)setModelData
(self, QWidget, …)sizeHint
(self, QStyleOptionViewItem, QModelIndex)updateEditorGeometry
(self, QWidget, …)
-
class
madgui.widget.tableview.
ListDelegate
(*, default=None, fmtspec=None)[source]¶ Bases:
madgui.widget.tableview.ItemDelegate
List value.
Methods
createEditor
(self, QWidget, …)display
(value)Render the value as string.
formatValue
(value)setEditorData
(self, QWidget, QModelIndex)setModelData
(self, QWidget, …)Attributes
Qt.Alignment()
-
textAlignment
= <PyQt5.QtCore.Qt.Alignment object>¶
-
-
class
madgui.widget.tableview.
NodeItem
(data=None, **kwargs)[source]¶ Bases:
object
Descriptor/type information for a TreeNode.
Methods
List of child rows (for expandable data).
get_row
()rowitems
(idx, data)
-
class
madgui.widget.tableview.
QuantityDelegate
(unit=None)[source]¶ Bases:
madgui.widget.tableview.ItemDelegate
Methods
createEditor
(self, QWidget, …)display
(value)Render the value as string.
setEditorData
(self, QWidget, QModelIndex)setModelData
(self, QWidget, …)Attributes
float(x) -> floating point number
str(object=’’) -> str
Qt.Alignment()
-
default
= 0.0¶
-
property
fmtspec
¶ str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
-
textAlignment
= <PyQt5.QtCore.Qt.Alignment object>¶
-
-
class
madgui.widget.tableview.
ReadOnlyDelegate
[source]¶ Bases:
PyQt5.QtWidgets.QStyledItemDelegate
Methods
createEditor
(self, QWidget, …)setEditorData
(self, QWidget, QModelIndex)setModelData
(self, QWidget, …)
-
class
madgui.widget.tableview.
StringDelegate
(*, default=None, fmtspec=None)[source]¶ Bases:
madgui.widget.tableview.ItemDelegate
Bare string value.
-
class
madgui.widget.tableview.
TableItem
(data=None, **kwargs)[source]¶ Bases:
madgui.widget.tableview.NodeItem
Cell item data for a tree widget.
Methods
Render the value as string.
get_edit
()Obtain value for the editor.
get_row
()get_rows
()set_checked
(value)Implement setting BoolDelegate via checkbox.
set_ui_value
(value)
-
class
madgui.widget.tableview.
TableModel
(titles, rowitems, data=None)[source]¶ Bases:
PyQt5.QtCore.QAbstractItemModel
Table data model.
Column specifications are provided as
TableItem
instances. The data can be accessed and changed via the list-likerows
.Methods
cell
(index)columnCount
(self, parent)data
(self, QModelIndex, role)flags
(self, QModelIndex)headerData
(self, int, Qt.Orientation, role)index
(self, int, int, parent)parent
(self, QModelIndex)parent(self) -> QObject
rowCount
(self, parent)setData
(self, QModelIndex, Any, role)Attributes
-
TableModel.index(self, int, int, parent: QModelIndex = QModelIndex()) -> QModelIndex
[source]
-
property
rows
¶
-
-
class
madgui.widget.tableview.
TableView
(*args, **kwargs)[source]¶ Bases:
madgui.widget.tableview.ItemView
,PyQt5.QtWidgets.QTableView
A table widget based on Qt’s QTableView for our
TableModel
.does not support expandable items
supports vertical header
currently supports background colors (since we don’t use css for QTableView)
Methods
header
()
-
class
madgui.widget.tableview.
TreeNode
(item, parent=None)[source]¶ Bases:
object
Proxy class for accessing contents/properties of a table cell. Delegates data queries to attributes of the associated :class`NodeItem`.
Attributes
Methods
data
(role)index
()setData
(value, role)-
property
children
¶
-
property
col
¶
-
index
()¶
-
property
row
¶
-
property
-
class
madgui.widget.tableview.
TreeView
(*args, **kwargs)[source]¶ Bases:
madgui.widget.tableview.ItemView
,PyQt5.QtWidgets.QTreeView
A tree widget based on Qt’s QTableView for our
TableModel
.supports expandable items
does not show item background color (apparently due to an incompatibility with css styling).
Methods
set_viewmodel
(rowitems[, data, unit, titles])