GridViewBase Class

The GridViewBase is a base class of the view used in the grid. It contains a set of properties and methods for control the behavior of the view, which can display data from an abstract Qt model. More...

Header: #include <GridViewBase>
Inherits: QObject
Inherited By:

GridCardView and GridTableView

Public Types

enum ActionType { ExpandAllAction, CollapseAllAction, SortNoneAction, SortAscendingAction, SortDescendingAction, …, PasteAction }
flags GridViewStates

Public Functions

void addToolWidget(QWidget *widget)
virtual void beginUpdate()
bool closeEditor()
void deselectAll()
virtual void endUpdate()
GridFilter *filter() const
void find(const QString &text, Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive, bool filter = false)
void findClear()
int focusedColumnIndex() const
GridRow focusedRow() const
int focusedRowIndex() const
GridRow getRow(const QModelIndex &index) const
GridRow getRow(int rowIndex) const
int getRowCount() const
GridBase *grid() const
void hideEditor()
QScrollBar *horizontalScrollBar() const
bool isPreviewRowExpanded(const GridRow &row) const
bool isRowShowing(const GridRow &row) const
GridModelController *modelController() const
GridViewOptions &options() const
bool postEditor()
void print(int *printer)
bool removeRow(const GridRow &row)
bool removeRows(const GridRow &row, int count)
void scrollToRow(const GridRow &row, bool topPosition = true)
void selectAll()
GridSelection *selection() const
void setModel(QAbstractItemModel *model, const QModelIndex &rootIndex = QModelIndex())
void setPreviewRowExpanded(const GridRow &row, bool expanded = true)
bool showEditor(GridEditor::ActivationPolicyFlag activationPolicy = GridEditor::NotActivate)
QScrollBar *verticalScrollBar() const

Public Slots

void bestFit(Qtitan::BestFitMode mode = Qtitan::FitToHeaderAndViewContent)
void collapseAll()
void copy()
void executeFilterDialog()
void expandAll()
void findNext()
void findPrevious()
void hideFieldChooser()
void hideFilterPanel()
void hideFindPanel(bool cancel = false)
bool isFieldChooserVisible() const
bool isFilterPanelVisible() const
bool isFindPanelVisible() const
void paste()
void showContextMenu(const QPoint &pos)
void showFieldChooser()
void showFilterEditor()
void showFilterPanel()
void showFindPanel(bool filterActive = false)

Signals

void editorStarted(EditorEventArgs *args)
void editorStarting(EditorEventArgs *args)
void editorStoped(EditorEventArgs *args)
void editorStoping(EditorEventArgs *args)

Detailed Description

Member Type Documentation

enum GridViewBase::ActionType

The enumerator describes the actions that used in data grid view.

ConstantValue
GridViewBase::ExpandAllAction0
GridViewBase::CollapseAllAction1
GridViewBase::SortNoneAction2
GridViewBase::SortAscendingAction3
GridViewBase::SortDescendingAction4
GridViewBase::HideColumnAction5
GridViewBase::GroupByColumnAction6
GridViewBase::GroupByBoxAction7
GridViewBase::FieldChooserAction8
GridViewBase::FooterAction9
GridViewBase::GroupFootersAction10
GridViewBase::AlignmentGroupAction11
GridViewBase::AlignLeftAction12
GridViewBase::AlignRightAction13
GridViewBase::AlignCenterAction14
GridViewBase::FilterAction15
GridViewBase::FilterEditorAction16
GridViewBase::FindAction17
GridViewBase::FindNextAction18
GridViewBase::FindPreviousAction19
GridViewBase::ZoomInAction20
GridViewBase::ZoomOutAction21
GridViewBase::DeleteRowAction22
GridViewBase::BestFitAction23
GridViewBase::CopyAction24
GridViewBase::PasteAction25

Member Function Documentation

void GridViewBase::addToolWidget(QWidget *widget)

Adds a custom tool widget to the grouping panel.

[virtual] void GridViewBase::beginUpdate()

Starts the view updating.

[slot] void GridViewBase::bestFit(Qtitan::BestFitMode mode = Qtitan::FitToHeaderAndViewContent)

Fits the width of the columns of the view for the most convenient viewing. The mode parameter specifies the different fit modes. Note: for GridCardView parameter mode always equal to BestFitMode::FitToHeader.

See also GridTableColumn::bestFit and GridTableBand::bestFit.

bool GridViewBase::closeEditor()

Posts the changed data to the model and cloase the editor.

See also postEditor.

[slot] void GridViewBase::collapseAll()

Collapses all the groups in the view.

[slot] void GridViewBase::copy()

Copies the selected cells to the clipboard.

void GridViewBase::deselectAll()

Undo selection for all cells or rows in a view in a multi-select mode.

See also selection(), selectAll(), selectRange(), selectRow(), and selectRowRange().

[signal] void GridViewBase::editorStarted(EditorEventArgs *args)

Triggered after editing of the value in the cell has started. The editor is visible and active.

[signal] void GridViewBase::editorStarting(EditorEventArgs *args)

Triggered before the value starts being edited in the grid cell.

[signal] void GridViewBase::editorStoped(EditorEventArgs *args)

Triggered after editing of the value in the cell has stopped. The editor is hidden.

[signal] void GridViewBase::editorStoping(EditorEventArgs *args)

Triggered before the value stops edited in the grid cell.

[virtual] void GridViewBase::endUpdate()

Ends the view updating.

[slot] void GridViewBase::executeFilterDialog()

Executes built-in Filter dialog that allows end-users to quickly apply a filter to the grid using a minimum of actions. The dialog is modal.

[slot] void GridViewBase::expandAll()

Expands all the groups in the view.

GridFilter *GridViewBase::filter() const

Returns the filter object for the view.

void GridViewBase::find(const QString &text, Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive, bool filter = false)

Findes for text in the grid. Additionally the text can be case sensitive caseSensitivity. Parameter filter specified that rows not contain the text should be hidden or not. Any text found is highlighted.

void GridViewBase::findClear()

Clears the find text.

[slot] void GridViewBase::findNext()

Performs a search in the cells for the next value that is specified in the find panel. Equivalent to clicking the 'Next' button in the find panel.

[slot] void GridViewBase::findPrevious()

Performs a search in the cells for the previous value that is specified in the find panel. Equivalent to clicking the 'Previous' button in the find panel.

int GridViewBase::focusedColumnIndex() const

Returns the index of the column that has the focus at the moment.

See also focusedRowIndex().

GridRow GridViewBase::focusedRow() const

Returns the row that has the focus at the moment.

See also focusedRowIndex().

int GridViewBase::focusedRowIndex() const

Returns the index of the row that has the focus at the moment.

See also focusedRow().

GridRow GridViewBase::getRow(const QModelIndex &index) const

Finds and returns GridRow by the QModelIndex index. If the row that matches the QModelIndex is not currently displayed (hidden by a filter or collapsed in a group), then an empty GridRow is returned.

GridRow GridViewBase::getRow(int rowIndex) const

Returns the GridRow by the rowIndex.

int GridViewBase::getRowCount() const

Returns the rows count in the view. Note: the number of rows may not coincide with the number of rows in the model. For example, when a filter is applied or grouped by column is used.

GridBase *GridViewBase::grid() const

Returns the grid widget for the view.

void GridViewBase::hideEditor()

Cancel the editing and hide the editor.

[slot] void GridViewBase::hideFieldChooser()

Hides field chooser panel.

[slot] void GridViewBase::hideFilterPanel()

Hides filter panel.

[slot] void GridViewBase::hideFindPanel(bool cancel = false)

Hides the find panel and clears all find settings.

QScrollBar *GridViewBase::horizontalScrollBar() const

Returns horizontal scroll bar of the view.

[slot] bool GridViewBase::isFieldChooserVisible() const

Returns true if field chooser panel visible on screen at the moment. Otherwise returns false.

[slot] bool GridViewBase::isFilterPanelVisible() const

Returns true if filter panel visible on screen at the moment. Otherwise returns false.

[slot] bool GridViewBase::isFindPanelVisible() const

Returns true if find panel visible on screen at the moment. Otherwise returns false.

bool GridViewBase::isPreviewRowExpanded(const GridRow &row) const

Returns true is preview row for grid row is expanded, otherwise it returs false.

See also GridViewOptions::setPreviewRowEnabled().

bool GridViewBase::isRowShowing(const GridRow &row) const

Returns true if specified row is visible on the view, otherwise it returs false.

GridModelController *GridViewBase::modelController() const

Returns the model controller that operates with the model.

GridViewOptions &GridViewBase::options() const

Returns the common options for all type of the views.

[slot] void GridViewBase::paste()

Inserts the clipboard data to the current row or cell.

bool GridViewBase::postEditor()

Posts the changed data to the model and returns true if successful.

See also postEditor and GridEditorRepository::immediatePost.

void GridViewBase::print(int *printer)

Prints the content of the grid to printer. Data is printed including grouping, filtering, summaries, selection. During the printing process, optimization is provided so that the data is correctly displayed on the paper sheet.

bool GridViewBase::removeRow(const GridRow &row)

Removes the row from the view and model. Before row will be removing, the signal rowRemoving() has raised. In the handler of the rowRemoving() signal you may process some action before. For instance show agree message box or disable the row deletion by set the RowRemovingEventArgs::setHandled() to true of the args.

See also RowRemovingEventArgs and rowRemoving().

bool GridViewBase::removeRows(const GridRow &row, int count)

Removes count rows starting with the given row from the view and model. Before rows will be removing, the signal rowRemoving() has raised. In the handler of GridViewBase::rowRemoving(RowRemovingEventArgs* args) signal you may process some action before. For instance show agree message box or disable the rows deletion by set the RowRemovingEventArgs::setHandled() to true. If the lastRow is NULL then the deletion will be continued till the last row in the view.

See also RowRemovingEventArgs and rowRemoving().

void GridViewBase::scrollToRow(const GridRow &row, bool topPosition = true)

Scrolls the view to the row to make it visible.

void GridViewBase::selectAll()

Select all cells or rows in a view in multi-select mode.

See also selection(), deselectAll(), selectRange(), selectRow(), and selectRowRange().

GridSelection *GridViewBase::selection() const

Returns GridSelection object to iterate by all selected cells or rows.

See also selectAll(), deselectAll(), selectRange(), selectRow(), and selectRowRange().

void GridViewBase::setModel(QAbstractItemModel *model, const QModelIndex &rootIndex = QModelIndex())

Method is intended to connect model with the data to the view. The model should be derived from class QAbstractItemModel.

See also GridViewOptions::autoCreateColumns().

void GridViewBase::setPreviewRowExpanded(const GridRow &row, bool expanded = true)

Allows you to expand or collapse the preview row for an arbitrary grid row. By default expanded parameter is true.

See also isPreviewRowExpanded().

[slot] void GridViewBase::showContextMenu(const QPoint &pos)

Shows grid context menu at the position pos.

bool GridViewBase::showEditor(GridEditor::ActivationPolicyFlag activationPolicy = GridEditor::NotActivate)

Start editing the focused cell. Param activationPolicy is used to tell the editor which event triggered the editing.

See also editorStarting and editorStarted.

[slot] void GridViewBase::showFieldChooser()

Shows field chooser panel.

[slot] void GridViewBase::showFilterEditor()

Shows built-in Filter Editor dialog that allows end-users to edit grid filter criteria using the tree-like structure of the filter conditionals. The dialog is modal.

[slot] void GridViewBase::showFilterPanel()

Shows filter panel.

[slot] void GridViewBase::showFindPanel(bool filterActive = false)

Shows the find panel. If paramter filterActive is true then the filter check box will be activated.

QScrollBar *GridViewBase::verticalScrollBar() const

Returns vertical scroll bar of the view.