GridColumnEditor Class
Header: | #include <GridColumnEditor> |
Inherits: | QObject |
Public Functions
GridColumnEditor(int borderThickness = 1) | |
virtual | ~GridColumnEditor() |
virtual int | borderThickness() |
virtual QWidget * | createEditorWidget(GridColumnBase *column) = 0 |
Detailed Description
Class allows to add QWidget to the column header. It used as a factory for QWidget creation. Use snippet below to add QPushButton to the column header.
class GridCustomColumnEditor: public Qtitan::GridColumnEditor { public: GridCustomColumnEditor() { } virtual QWidget* GridCustomColumnEditor::createEditorWidget(Qtitan::GridColumnBase* column) { QPushButton* button = new QPushButton(); button->setText("text"); return button; } }; ... void initColumnEditor() { Qtitan::GridTableColumn* column = (Qtitan::GridTableColumn *)view->getColumnByModelColumnName("Column"); GridCustomColumnEditor* columnEditor = new GridCustomColumnEditor(); column->setColumnEditor(columnEditor); } void freeColumnEditor() { Qtitan::GridTableColumn* column = (Qtitan::GridTableColumn *)view->getColumnByModelColumnName("Column"); GridCustomColumnEditor* columnEditor = column->columnEditor(); column->setColumnEditor(0); delete columnEditor; }
Member Function Documentation
GridColumnEditor::GridColumnEditor(int borderThickness = 1)
Contructor of GridColumnEditor. Parameter borderThickness is the border thickness around the column editor in pixels.
[virtual noexcept]
GridColumnEditor::~GridColumnEditor()
Destructor of GridColumnEditor
[virtual]
int GridColumnEditor::borderThickness()
Returns the border thickness around the column editor. By default it is 1 pixel.
[pure virtual]
QWidget *GridColumnEditor::createEditorWidget(GridColumnBase *column)
Create a widget that will be used in column header. You do not have to worry about deleting the widget. The owner of the widget to become a column header. The widget will be deleted when you remove a column or will be reset to null an column editor - column->setColumnEditor(0).