BasicTableView QML Type

Inherits:

ScrollView

Inherited By:

TableView and TreeView

Properties

Methods

Detailed Description

Property Documentation

alternatingRowColors : bool

This property is set to true if the view alternates the row color. The default value is true.


backgroundVisible : bool

This property determines if the background should be filled or not.

The default value is true.

Note: The rowDelegate is not affected by this property


[read-only] columnCount : int

The current number of columns


contentFooter : Component

This is the content footer of the view.


contentHeader : Component

This is the content header of the view.


headerDelegate : Component

This property defines a delegate to draw a header.

In the header delegate you have access to the following special properties:

  • styleData.value - the value or text for this item
  • styleData.column - the index of the column
  • styleData.pressed - true when the column is being pressed
  • styleData.containsMouse - true when the column is under the mouse
  • styleData.textAlignment - the horizontal text alignment of the column (since QtQuickControls 1.1)

headerVisible : bool

This property determines if the header is visible. The default value is true.


rowDelegate : Component

This property defines a delegate to draw a row.

In the row delegate you have access to the following special properties:

  • styleData.alternate - true when the row uses the alternate background color
  • styleData.selected - true when the row is currently selected
  • styleData.row - the index of the row
  • styleData.hasActiveFocus - true when the row has focus (since QtQuick.Controls 1.3)
  • styleData.pressed - true when the row is pressed (since QtQuick.Controls 1.3)

Note: For performance reasons, created delegates can be recycled across multiple table rows. This implies that when you make use of implicit properties such as styleData.row or model, these values can change after the delegate has been constructed. This means that you should not assume that content is fixed when Component.onCompleted is called, but instead rely on bindings to such properties.


selectionMode : int

This enum indicates how the view responds to user selections:

The possible modes are:

  • SelectionMode.NoSelection - Items cannot be selected.
  • SelectionMode.SingleSelection - When the user selects an item, any already-selected item becomes unselected, and the user cannot unselect the selected item. (Default)
  • SelectionMode.MultiSelection - When the user selects an item in the usual way, the selection status of that item is toggled and the other items are left alone.
  • SelectionMode.ExtendedSelection - When the user selects an item in the usual way, the selection is cleared and the new item selected. However, if the user presses the Ctrl key when clicking on an item, the clicked item gets toggled and all other items are left untouched. If the user presses the Shift key while clicking on an item, all items between the current item and the clicked item are selected or unselected, depending on the state of the clicked item. Multiple items can be selected by dragging the mouse over them.
  • SelectionMode.ContiguousSelection - When the user selects an item in the usual way, the selection is cleared and the new item selected. However, if the user presses the Shift key while clicking on an item, all items between the current item and the clicked item are selected.

This property was introduced in QtQuick.Controls 1.1.


sortIndicatorColumn : int

Index of the current sort column. The default value is 0.


sortIndicatorOrder : int

This sets the sorting order of the sort indicator The allowed values are:

  • Qt.AscendingOrder - the default
  • Qt.DescendingOrder

sortIndicatorVisible : bool

This property shows or hides the sort indicator The default value is false.

Note: The view itself does not sort the data.


Method Documentation

TableViewColumn addColumn(object column)

Adds a column and returns the added column.

The column argument can be an instance of TableViewColumn, or a Component. The component has to contain a TableViewColumn. Otherwise null is returned.


TableViewColumn getColumn(int index)

Returns the column at the given index or null if the index is invalid.


TableViewColumn insertColumn(int index, object column)

Inserts a column at the given index and returns the inserted column.

The column argument can be an instance of TableViewColumn, or a Component. The component has to contain a TableViewColumn. Otherwise null is returned.


void moveColumn(int from, int to)

Moves a column from index to another.


void removeColumn(int index)

Removes and destroys a column at the given index.


void resizeColumnsToContents()

Resizes all columns to ensure that the column contents and the headers will fit.

This method was introduced in QtQuick.Controls 1.2.