|
RTC Toolkit 6.0.0
|
A Qt model for Numpy ndarray objects that can be used with QTableView widgets. More...
Public Member Functions | |
| __init__ (self, Optional[numpy.ndarray] data=None, *args, **kwargs) | |
| Optional[numpy.ndarray] | get_array_data (self) |
| Get the internal numpy array data. | |
| set_array_data (self, Optional[numpy.ndarray] data) | |
| Set the internal numpy ndarray and signal the parts of the data that have been effectively changed in the model. | |
| int | rowCount (self, QModelIndex parent=QModelIndex()) |
| Return the number of rows in the ndarray. | |
| int | columnCount (self, QModelIndex parent=QModelIndex()) |
| Return the number of columns in the ndarray. | |
| QModelIndex | index (self, int row, int column, QModelIndex parent=QModelIndex()) |
| Creates an index into the model for a given row and column. | |
| Qt.ItemFlags | flags (self, QModelIndex index) |
| Returns property flags for an element of the ndarray indicated by index. | |
| data (self, QModelIndex index, int role=Qt.DisplayRole) | |
| Returns the data for a specific cell in the model identified by the index and for a specific role (the display role by default). | |
| bool | setData (self, QModelIndex index, value, int role=Qt.DisplayRole) |
| Sets the data value for a specific cell in the model identified by the index and for a specific role. | |
| headerData (self, int section, Qt.Orientation orientation, int role=Qt.DisplayRole) | |
| Returns information about a column or row depending on the orientation. | |
| bool | insertRows (self, int position, int rows, QModelIndex parent=QModelIndex()) |
| Inserts count new rows into the model before the given row. | |
| bool | insertColumns (self, int position, int columns, QModelIndex parent=QModelIndex()) |
| Inserts count new columns into the model before the given column. | |
| bool | removeRows (self, int position, int rows, QModelIndex parent=QModelIndex()) |
| Removes count rows starting with the given row from the model. | |
| bool | removeColumns (self, int position, int columns, QModelIndex parent=QModelIndex()) |
| Removes count columns starting with the given column from the model. | |
| bool | moveRows (self, QModelIndex source_parent, int source_row, int count, QModelIndex destination_parent, int destination_child) |
| Moves one or more rows in the table model. | |
| bool | moveColumns (self, QModelIndex source_parent, int source_column, int count, QModelIndex destination_parent, int destination_child) |
| Moves one or more columns in the table model. | |
| Qt.DropActions | supportedDropActions (self) |
| Returns the drop actions supported by the model, in this case copy and move. | |
| setItemData (self, index, roles) | |
| Update data for a particular index for one or more roles. | |
| list | mimeTypes (self) |
| Extends the mime types supported by the model with text/plain to allow external drag and drop. | |
| bool | dropMimeData (self, QMimeData data, Qt.DropAction action, int row, int column, QModelIndex parent) |
| Handle the data supplied by a drag and drop operation. | |
| QMimeData | mimeData (self, list[QModelIndex] indexes) |
| Extends the mime data by the model with text/plain to allow drag and drop to external applications. | |
Protected Attributes | |
| _array_data = None | |
A Qt model for Numpy ndarray objects that can be used with QTableView widgets.
This customised model is optimised to handle large ndarrays by accessing the data directly from an existing ndarray instance.
| gui.ndarray_model.NdarrayModel.__init__ | ( | self, | |
| Optional[numpy.ndarray] | data = None, | ||
| * | args, | ||
| ** | kwargs ) |
| int gui.ndarray_model.NdarrayModel.columnCount | ( | self, | |
| QModelIndex | parent = QModelIndex() ) |
Return the number of columns in the ndarray.
| gui.ndarray_model.NdarrayModel.data | ( | self, | |
| QModelIndex | index, | ||
| int | role = Qt.DisplayRole ) |
Returns the data for a specific cell in the model identified by the index and for a specific role (the display role by default).
| bool gui.ndarray_model.NdarrayModel.dropMimeData | ( | self, | |
| QMimeData | data, | ||
| Qt.DropAction | action, | ||
| int | row, | ||
| int | column, | ||
| QModelIndex | parent ) |
Handle the data supplied by a drag and drop operation.
Returns True if the data and action were handled by the model and False otherwise.
| Qt.ItemFlags gui.ndarray_model.NdarrayModel.flags | ( | self, | |
| QModelIndex | index ) |
Returns property flags for an element of the ndarray indicated by index.
The flags indicate the elements are enabled, selectable, editable dragable and dropable.
| Optional[numpy.ndarray] gui.ndarray_model.NdarrayModel.get_array_data | ( | self | ) |
Get the internal numpy array data.
| gui.ndarray_model.NdarrayModel.headerData | ( | self, | |
| int | section, | ||
| Qt.Orientation | orientation, | ||
| int | role = Qt.DisplayRole ) |
Returns information about a column or row depending on the orientation.
| QModelIndex gui.ndarray_model.NdarrayModel.index | ( | self, | |
| int | row, | ||
| int | column, | ||
| QModelIndex | parent = QModelIndex() ) |
Creates an index into the model for a given row and column.
Note that parent must always be QModelIndex() for a table model such as this one.
| bool gui.ndarray_model.NdarrayModel.insertColumns | ( | self, | |
| int | position, | ||
| int | columns, | ||
| QModelIndex | parent = QModelIndex() ) |
Inserts count new columns into the model before the given column.
If column is 0, the columns are prepended to any existing columns. If column is columnCount(), the columns are appended to any existing columns.
Note that parent must always be QModelIndex().
Returns True if the columns were successfully inserted; otherwise returns False.
| bool gui.ndarray_model.NdarrayModel.insertRows | ( | self, | |
| int | position, | ||
| int | rows, | ||
| QModelIndex | parent = QModelIndex() ) |
Inserts count new rows into the model before the given row.
If row is 0, the rows are prepended to any existing rows in the parent. If row is rowCount(), the rows are appended to any existing rows in the parent.
Note that parent must always be QModelIndex().
Returns True if the rows were successfully inserted; otherwise returns False.
| QMimeData gui.ndarray_model.NdarrayModel.mimeData | ( | self, | |
| list[QModelIndex] | indexes ) |
Extends the mime data by the model with text/plain to allow drag and drop to external applications.
| list gui.ndarray_model.NdarrayModel.mimeTypes | ( | self | ) |
Extends the mime types supported by the model with text/plain to allow external drag and drop.
| bool gui.ndarray_model.NdarrayModel.moveColumns | ( | self, | |
| QModelIndex | source_parent, | ||
| int | source_column, | ||
| int | count, | ||
| QModelIndex | destination_parent, | ||
| int | destination_child ) |
Moves one or more columns in the table model.
Returns True if the columns were moved successfully and False otherwise.
| bool gui.ndarray_model.NdarrayModel.moveRows | ( | self, | |
| QModelIndex | source_parent, | ||
| int | source_row, | ||
| int | count, | ||
| QModelIndex | destination_parent, | ||
| int | destination_child ) |
Moves one or more rows in the table model.
Returns True if the rows were moved successfully and False otherwise.
| bool gui.ndarray_model.NdarrayModel.removeColumns | ( | self, | |
| int | position, | ||
| int | columns, | ||
| QModelIndex | parent = QModelIndex() ) |
Removes count columns starting with the given column from the model.
Note that parent must always be QModelIndex().
Returns True if the columns were successfully removed; otherwise returns False.
| bool gui.ndarray_model.NdarrayModel.removeRows | ( | self, | |
| int | position, | ||
| int | rows, | ||
| QModelIndex | parent = QModelIndex() ) |
Removes count rows starting with the given row from the model.
Note that parent must always be QModelIndex().
Returns True if the rows were successfully removed; otherwise returns False.
| int gui.ndarray_model.NdarrayModel.rowCount | ( | self, | |
| QModelIndex | parent = QModelIndex() ) |
Return the number of rows in the ndarray.
| gui.ndarray_model.NdarrayModel.set_array_data | ( | self, | |
| Optional[numpy.ndarray] | data ) |
Set the internal numpy ndarray and signal the parts of the data that have been effectively changed in the model.
| bool gui.ndarray_model.NdarrayModel.setData | ( | self, | |
| QModelIndex | index, | ||
| value, | |||
| int | role = Qt.DisplayRole ) |
Sets the data value for a specific cell in the model identified by the index and for a specific role.
Should normally use the Qt.EditRole.
| gui.ndarray_model.NdarrayModel.setItemData | ( | self, | |
| index, | |||
| roles ) |
Update data for a particular index for one or more roles.
| index | The model index of the table cell that should be updated. |
| roles | A dictionary of role and value pairs, i.e. the data per role to be updated. |
Returns True if data was updated successfully for at least one role and False otherwise.
| Qt.DropActions gui.ndarray_model.NdarrayModel.supportedDropActions | ( | self | ) |
Returns the drop actions supported by the model, in this case copy and move.
|
protected |