This module provides table widgets handling cut, copy and paste for multiple cell selections. These actions can be triggered using keyboard shortcuts or through a context menu (right-click).
TableView is a subclass of QTableView. The added features are made available to users after a model is added to the widget, using TableView.setModel().
TableWidget is a subclass of qt.QTableWidget, a table view with a built-in standard data model. The added features are available as soon as the widget is initialized.
The cut, copy and paste actions are implemented as QActions:
- CopySelectedCellsAction (Ctrl+C)
- CopyAllCellsAction
- CutSelectedCellsAction (Ctrl+X)
- CutAllCellsAction
- PasteCellsAction (Ctrl+V)
The copy actions are enabled by default. The cut and paste actions must be explicitly enabled, by passing parameters cut=True, paste=True when creating the widgets, or later by calling their enableCut() and enablePaste() methods.
Bases: PyQt4.QtGui.QTableWidget
QTableWidget with a context menu displaying up to 5 actions:
These actions interact with the clipboard and can be used to copy data to or from an external application, or another widget.
The cut and paste actions are disabled by default, due to the risk of overwriting data (no Undo action is available). Use enablePaste() and enableCut() to activate them.
Parameters: |
|
---|
Bases: PyQt4.QtGui.QTableView
QTableView with a context menu displaying up to 5 actions:
These actions interact with the clipboard and can be used to copy data to or from an external application, or another widget.
The cut and paste actions are disabled by default, due to the risk of overwriting data (no Undo action is available). Use enablePaste() and enableCut() to activate them.
Note
These actions will be available only after a model is associated with this view, using setModel().
Parameters: |
|
---|
Set the data model for the table view, activate the actions and the context menu.
Parameters: | model – qt.QAbstractItemModel object |
---|
Bases: PyQt4.QtGui.QAction
QAction to copy text from selected cells in a QTableWidget into the clipboard.
If multiple cells are selected, the copied text will be a concatenation of the texts in all selected cells, tabulated with tabulation and newline characters.
If the cells are sparsely selected, the structure is preserved by representing the unselected cells as empty strings in between two tabulation characters. Beware of pasting this data in another table widget, because depending on how the paste is implemented, the empty cells may cause data in the target table to be deleted, even though you didn’t necessarily select the corresponding cell in the origin table.
Parameters: | table – QTableView to which this action belongs. |
---|
Bases: PyQt4.QtGui.QAction
QAction to copy text from all cells in a QTableWidget into the clipboard.
The copied text will be a concatenation of the texts in all cells, tabulated with tabulation and newline characters.
Parameters: | table – QTableView to which this action belongs. |
---|
Bases: silx.gui.widgets.TableWidget.CopySelectedCellsAction
QAction to cut text from selected cells in a QTableWidget into the clipboard.
The text is deleted from the original table widget (use CopySelectedCellsAction to preserve the original data).
If multiple cells are selected, the cut text will be a concatenation of the texts in all selected cells, tabulated with tabulation and newline characters.
If the cells are sparsely selected, the structure is preserved by representing the unselected cells as empty strings in between two tabulation characters. Beware of pasting this data in another table widget, because depending on how the paste is implemented, the empty cells may cause data in the target table to be deleted, even though you didn’t necessarily select the corresponding cell in the origin table.
Parameters: | table – QTableView to which this action belongs. |
---|
Bases: silx.gui.widgets.TableWidget.CopyAllCellsAction
QAction to cut text from all cells in a QTableWidget into the clipboard.
The text is deleted from the original table widget (use CopyAllCellsAction to preserve the original data).
The cut text will be a concatenation of the texts in all cells, tabulated with tabulation and newline characters.
Parameters: | table – QTableView to which this action belongs. |
---|
Bases: PyQt4.QtGui.QAction
QAction to paste text from the clipboard into the table.
If the text contains tabulations and newlines, they are interpreted as column and row separators. In such a case, the text is split into multiple texts to be pasted into multiple cells.
If a cell content is an empty string in the original text, it is ignored: the destination cell’s text will not be deleted.
Parameters: | table – QTableView to which this action belongs. |
---|