TableView QML Type▲
-
Import Statement: import QtQuick
-
Since: Qt 5.12
-
Inherited By:: https://, https://, and https://
-
Inherits: Flickable
-
Group: TableView is part of qtquick-views
Detailed Description▲
A https:// has a https:// that defines the data to be displayed, and a https:// that defines how the data should be displayed.
https:// inherits https://. This means that while the model can have any number of rows and columns, only a subsection of the table is usually visible inside the viewport. As soon as you flick, new rows and columns enter the viewport, while old ones exit and are removed from the viewport. The rows and columns that move out are reused for building the rows and columns that move into the viewport. As such, the https:// support models of any size without affecting performance.
A https:// displays data from models created from built-in QML types such as https:// and https://, which populates the first column only in a https://. To create models with multiple columns, either use https:// or a C++ model that inherits https://.
Example Usage▲
C++ Models▲
The following example shows how to create a model from C++ with multiple columns:
#include <qqml.h>
#include <QAbstractTableModel>
class TableModel : public QAbstractTableModel
{
Q_OBJECT
QML_ELEMENT
QML_ADDED_IN_MINOR_VERSION(1)
public:
int rowCount(const QModelIndex & = QModelIndex()) const override
{
return 200;
}
int columnCount(const QModelIndex & = QModelIndex()) const override
{
return 200;
}
QVariant data(const QModelIndex &index, int role) const override
{
switch (role) {
case Qt::DisplayRole:
return QString("%1, %2").arg(index.column()).arg(index.row());
default:
break;
}
return QVariant();
}
QHash<int, QByteArray> roleNames() const override
{
return { {Qt::DisplayRole, "display"} };
}
};And then how to use it from QML:
import QtQuick 2.12
import TableModel 0.1
TableView {
anchors.fill: parent
columnSpacing: 1
rowSpacing: 1
clip: true
model: TableModel {}
delegate: Rectangle {
implicitWidth: 100
implicitHeight: 50
Text {
text: display
}
}
}QML Models▲
For prototyping and displaying very simple data (from a web API, for example), https:// can be used:
import QtQuick 2.14
import Qt.labs.qmlmodels 1.0
TableView {
anchors.fill: parent
columnSpacing: 1
rowSpacing: 1
clip: true
model: TableModel {
TableModelColumn { display: "name" }
TableModelColumn { display: "color" }
rows: [
{
"name": "cat",
"color": "black"
},
{
"name": "dog",
"color": "brown"
},
{
"name": "bird",
"color": "white"
}
]
}
delegate: Rectangle {
implicitWidth: 100
implicitHeight: 50
border.width: 1
Text {
text: display
anchors.centerIn: parent
}
}
}Reusing items▲
https:// recycles delegate items by default, instead of instantiating from the https:// whenever new rows and columns are flicked into view. This approach gives a huge performance boost, depending on the complexity of the delegate.
When an item is flicked out, it moves to the reuse pool, which is an internal cache of unused items. When this happens, the https:// signal is emitted to inform the item about it. Likewise, when the item is moved back from the pool, the https:// signal is emitted.
Any item properties that come from the model are updated when the item is reused. This includes index, row, and column, but also any model roles.
Avoid storing any state inside a delegate. If you do, reset it manually on receiving the https:// signal.
If an item has timers or animations, consider pausing them on receiving the https:// signal. That way you avoid using the CPU resources for items that are not visible. Likewise, if an item has resources that cannot be reused, they could be freed up.
If you don't want to reuse items or if the https:// cannot support it, you can set the https:// property to false.
While an item is in the pool, it might still be alive and respond to connected signals and bindings.
The following example shows a delegate that animates a spinning rectangle. When it is pooled, the animation is temporarily paused:
Component {
id: tableViewDelegate
Rectangle {
implicitWidth: 100
implicitHeight: 50
TableView.onPooled: rotationAnimation.pause()
TableView.onReused: rotationAnimation.resume()
Rectangle {
id: rect
anchors.centerIn: parent
width: 40
height: 5
color: "green"
RotationAnimation {
id: rotationAnimation
target: rect
duration: (Math.random() * 2000) + 200
from: 0
to: 359
running: true
loops: Animation.Infinite
}
}
}
}Row heights and column widths▲
When a new column is flicked into view, https:// will determine its width by calling the https:// function. https:// does not store row height or column width, as it's designed to support large models containing any number of rows and columns. Instead, it will ask the application whenever it needs to know.
https:// uses the largest implicitWidth among the items as the column width, unless the https:// property is explicitly set. Once the column width is found, all other items in the same column are resized to this width, even if new items that are flicked in later have larger implicitWidth. Setting an explicit width on an item is ignored and overwritten.
The calculated width of a column is discarded when it is flicked out of the viewport, and is recalculated if the column is flicked back in. The calculation is always based on the items that are visible when the column is flicked in. This means that column width can be different each time, depending on which row you're at when the column enters. You should therefore have the same implicitWidth for all items in a column, or set https://. The same logic applies for the row height calculation.
If you change the values that a https:// or a https:// return for rows and columns inside the viewport, you must call https://. This informs https:// that it needs to use the provider functions again to recalculate and update the layout.
Since Qt 5.13, if you want to hide a specific column, you can return 0 from the https:// for that column. Likewise, you can return 0 from the https:// to hide a row. If you return a negative number, https:// will fall back to calculate the size based on the delegate items.
The size of a row or column should be a whole number to avoid sub-pixel alignment of items.
The following example shows how to set a simple columnWidthProvider together with a timer that modifies the values the function returns. When the array is modified, https:// is called to let the changes take effect:
TableView {
id: tableView
property var columnWidths: [100, 50, 80, 150]
columnWidthProvider: function (column) { return columnWidths[column] }
Timer {
running: true
interval: 2000
onTriggered: {
tableView.columnWidths[2] = 150
tableView.forceLayout();
}
}
}Overlays and underlays▲
All new items that are instantiated from the delegate are parented to the https:// with the z value, 1. You can add your own items inside the Tableview, as child items of the Flickable. By controlling their z value, you can make them be on top of or underneath the table items.
Here is an example that shows how to add some text on top of the table, that moves together with the table as you flick:
TableView {
id: tableView
topMargin: header.implicitHeight
Text {
id: header
text: "A table header"
}
}Selecting items▲
You can add selection support to https:// by assigning an https:// to the https:// property. It will then use this model to control which delegate items should be shown as selected, and which item should be shown as current. You can set https:// to control if the user should be allowed to select individual cells, rows, or columns.
To find out whether a delegate is selected or current, declare the following properties:
delegate: Item {
required property bool selected
required property bool current
// ...
}the selected and current properties must be defined as required. This will inform https:// that it should take responsibility for updating their values. If not, they will simply be ignored. See also https://.
The following snippet shows how an application can render the delegate differently depending on the selected property:
TableView {
id: tableView
anchors.fill: parent
clip: true
model: TableModel {
TableModelColumn { display: "name" }
rows: [ { "name": "Harry" }, { "name": "Hedwig" } ]
}
selectionModel: ItemSelectionModel {}
delegate: Rectangle {
implicitWidth: 100
implicitHeight: 30
color: selected ? "blue" : "lightgray"
required property bool selected
Text { text: display }
}
}The https:// and https:// properties can also be useful if you need to render a delegate differently depending on if it lies on the same row or column as the current item.
https:// offers a https:// that can be used to let the user select cells.
By default, a cell will become current, and any selections will be removed, when the user taps on it. If such default tap behavior is not wanted (e.g if you use custom pointer handlers inside your delegate), you can set https:// to false.
Keyboard navigation▲
Copy and paste▲
Implementing copy and paste operations for a https:// usually also includes using a https:// (or some other undo/redo framework). The https:// can be used to store the different operations done on the model, like adding or removing rows, or pasting data from the clipboard, with a way to undo it again later. However, an accompanying https:// that describes the possible operations, and how to undo them, should be designed according to the needs of the model and the application. As such, https:// doesn't offer a built-in API for handling copy and paste.
The following snippet can be used as a reference for how to add copy and paste support to your model and https://. It uses the existing mime data API in https://, together with https://. The snippet will work as it is, but can also be extended to use a https://.
// Inside your C++ QAbstractTableModel subclass:
Q_INVOKABLE void copyToClipboard(const QModelIndexList &indexes) const
{
QGuiApplication::clipboard()->setMimeData(mimeData(indexes));
}
Q_INVOKABLE bool pasteFromClipboard(const QModelIndex &targetIndex)
{
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData();
// Consider using a QUndoCommand for the following call. It should store
// the (mime) data for the model items that are about to be overwritten, so
// that a later call to undo can revert it.
return dropMimeData(mimeData, Qt::CopyAction, -1, -1, targetIndex);
}The two functions can, for example, be used from QML like this:
TableView {
id: tableView
model: tableModel
selectionModel: ItemSelectionModel {}
Shortcut {
sequence: StandardKey.Copy
onActivated: {
let indexes = tableView.selectionModel.selectedIndexes
tableView.model.copyToClipboard(indexes)
}
}
Shortcut {
sequence: StandardKey.Paste
onActivated: {
let targetIndex = tableView.selectionModel.currentIndex
tableView.model.pasteFromClipboard(targetIndex)
}
}
}See Also▲
See also https://, dropMimeData(), QUndoStack, https://, https://
Property Documentation▲
alternatingRows : bool▲
This property controls whether the background color of the rows should alternate. The default value is style dependent.
This property is only a hint, and might therefore not be respected by custom delegates. It's recommended that a delegate alternates between palette.base and palette.alternateBase when this hint is true, so that the colors can be set from outside of the delegate. For example:
background: Rectangle {
color: control.row === control.tableView.currentRow
? control.palette.highlight
: (control.tableView.alternatingRows && control.row % 2 !== 0
? control.palette.alternateBase
: control.palette.base)
}[since 6.4] animate : bool▲
This property can be set to control if https:// should animate the https:// (https:// and https://). It is used by https://(), and when navigating https:// with the keyboard. The default value is true.
If set to false, any ongoing animation will immediately stop.
This property is only a hint. https:// might choose to position the content item without an animation if, for example, the target cell is not https://. However, if set to false, animations will always be off.
This property was introduced in Qt 6.4.
See Also▲
See also https://()
bottomRow : int▲
This property holds the bottom-most row that is currently visible inside the view.
See Also▲
See also https://, https://, https://
columnSpacing : real▲
This property holds the spacing between the columns.
The default value is 0.
columnWidthProvider : var▲
This property can hold a function that returns the column width for each column in the model. It is called whenever https:// needs to know the width of a specific column. The function takes one argument, column, for which the https:// needs to know the width.
Since Qt 5.13, if you want to hide a specific column, you can return 0 width for that column. If you return a negative number, https:// calculates the width based on the delegate items.
The columnWidthProvider will usually be called two times when a column is about to load (or when doing layout). First, to know if the column is visible and should be loaded. And second, to determine the width of the column after all items have been loaded. If you need to calculate the column width based on the size of the delegate items, you need to wait for the second call, when all the items have been loaded. You can check for this by calling https://(column), and simply return -1 if that is not yet the case.
See Also▲
See also https://, https://(), https://
[read-only] columns : int▲
This property holds the number of columns in the table.
columns is usually equal to the number of columns in the model, but can temporarily differ until all pending model changes have been processed.
If the model is a list, columns will be 1.
This property is read only.
contentHeight : real▲
This property holds the table height required to accommodate the number of rows in the data model. This is usually not the same as the height of the view, which means that the table's height could be larger or smaller than the viewport height. As a https:// cannot always know the exact height of the table without loading all rows in the model, the contentHeight is usually an estimate based on the initially loaded table.
If you know what the height of the table will be, assign a value to contentHeight, to avoid unnecessary calculations and updates to the https://.
See Also▲
See also https://, https://
contentWidth : real▲
This property holds the table width required to accommodate the number of columns in the model. This is usually not the same as the width of the https://, which means that the table's width could be larger or smaller than the viewport width. As a https:// cannot always know the exact width of the table without loading all columns in the model, the contentWidth is usually an estimate based on the initially loaded table.
If you know what the width of the table will be, assign a value to contentWidth, to avoid unnecessary calculations and updates to the https://.
See Also▲
See also https://, https://
[read-only] currentColumn : int▲
This read-only property holds the column in the view that contains the item that is current. If no item is current, it will be -1.
In order for https:// to report what the current column is, you need to assign an https:// to https://.
See Also▲
See also https://, https://, https://
[read-only] currentRow : int▲
This read-only property holds the row in the view that contains the item that is current. If no item is current, it will be -1.
In order for https:// to report what the current row is, you need to assign an https:// to https://.
See Also▲
See also https://, https://, https://
delegate : Component▲
The delegate provides a template defining each cell item instantiated by the view. The model index is exposed as an accessible index property. The same applies to row and column. Properties of the model are also available depending upon the type of https://.
A delegate should specify its size using https:// and https://. The https:// lays out the items based on that information. Explicit width or height settings are ignored and overwritten.
Delegates are instantiated as needed and may be destroyed at any time. They are also reused if the https:// property is set to true. You should therefore avoid storing state information in the delegates.
See Also▲
See also https://, https://
[since 6.4] keyNavigationEnabled : bool▲
In order for https:// to support keyboard navigation, you need to assign an https:// to https://.
This property was introduced in Qt 6.4.
See Also▲
See also https://, https://, https://, https://, https://
leftColumn : int▲
This property holds the leftmost column that is currently visible inside the view.
See Also▲
See also https://, https://, https://
model : model▲
This property holds the model that provides data for the table.
The model provides the set of data that is used to create the items in the view. Models can be created directly in QML using https://, https://, https://, or provided by a custom C++ model class. The C++ model must be a subclass of https:// or a simple list.
See Also▲
See also https://
[since 6.4] pointerNavigationEnabled : bool▲
reuseItems : bool▲
This property holds whether or not items instantiated from the https:// should be reused. If set to false, any currently pooled items are destroyed.
See Also▲
See also https://, https://, https://
rightColumn : int▲
This property holds the rightmost column that is currently visible inside the view.
See Also▲
See also https://, https://, https://
rowHeightProvider : var▲
This property can hold a function that returns the row height for each row in the model. It is called whenever https:// needs to know the height of a specific row. The function takes one argument, row, for which the https:// needs to know the height.
Since Qt 5.13, if you want to hide a specific row, you can return 0 height for that row. If you return a negative number, https:// calculates the height based on the delegate items.
The rowHeightProvider will usually be called two times when a row is about to load (or when doing layout). First, to know if the row is visible and should be loaded. And second, to determine the height of the row after all items have been loaded. If you need to calculate the row height based on the size of the delegate items, you need to wait for the second call, when all the items have been loaded. You can check for this by calling https://(row), and simply return -1 if that is not yet the case.
See Also▲
See also rowHeightProvider, https://(), https://
rowSpacing : real▲
This property holds the spacing between the rows.
The default value is 0.
[read-only] rows : int▲
This property holds the number of rows in the table.
rows is usually equal to the number of rows in the model, but can temporarily differ until all pending model changes have been processed.
This property is read only.
[since 6.4] selectionBehavior : enumeration▲
This property holds whether the user can select single cells, rows or columns.
-
https://.SelectionDisabled - the user cannot perform selections.
-
https://.SelectCells (default) - the user can select individual cells.
-
https://.SelectRows - the user can only select rows.
-
https://.SelectColumns - the user can only select columns.
This property was introduced in Qt 6.4.
See Also▲
See also https://, https://, https://
[since 6.2] selectionModel : ItemSelectionModel▲
This property can be set to control which delegate items should be shown as selected, and which item should be shown as current. If the delegate has a required property bool selected defined, https:// will keep it in sync with the selection state of the corresponding model item in the selection model. If the delegate has a required property bool current defined, https:// will keep it in sync with selectionModel.currentIndex.
This property was introduced in Qt 6.2.
See Also▲
See also https://, https://, https://, https://
syncDirection : Qt::Orientations▲
If the https:// is set on a https://, this property controls synchronization of flicking direction(s) for both tables. The default is Qt.Horizontal | Qt.Vertical, which means that if you flick either table in either direction, the other table is flicked the same amount in the same direction.
This property and https:// can be used to make two tableViews synchronize with each other smoothly in flicking regardless of the different overshoot/undershoot, velocity, acceleration/deceleration or rebound animation, and so on.
A typical use case is to make several headers flick along with the table.
See Also▲
See also https://
syncView : TableView▲
If this property of a https:// is set to another https://, both the tables will synchronize with regard to flicking, column widths/row heights, and spacing according to https://.
If https:// contains https://, current tableView's column widths, column spacing, and horizontal flicking movement synchronizes with syncView's.
If https:// contains https://, current tableView's row heights, row spacing, and vertical flicking movement synchronizes with syncView's.
See Also▲
See also https://
topRow : int▲
This property holds the topmost row that is currently visible inside the view.
See Also▲
See also https://, https://, https://
Attached Property Documentation▲
TableView.view : TableView▲
This attached property holds the view that manages the delegate instance. It is attached to each instance of the delegate.
Attached Signal Documentation▲
pooled()▲
This signal is emitted after an item has been added to the reuse pool. You can use it to pause ongoing timers or animations inside the item, or free up resources that cannot be reused.
This signal is emitted only if the https:// property is true.
The corresponding handler is onPooled.
See Also▲
See also https://, https://, https://
reused()▲
This signal is emitted after an item has been reused. At this point, the item has been taken out of the pool and placed inside the content view, and the model properties such as index, row, and column have been updated.
Other properties that are not provided by the model does not change when an item is reused. You should avoid storing any state inside a delegate, but if you do, manually reset that state on receiving this signal.
This signal is emitted when the item is reused, and not the first time the item is created.
This signal is emitted only if the https:// property is true.
The corresponding handler is onReused.
See Also▲
See also https://, https://, https://
Method Documentation▲
[since 6.4] point cellAtIndex(QModelIndex modelIndex)▲
Returns the cell in the view that maps to modelIndex in the model. Convenience function for doing:
Qt.point(columnAtIndex(modelIndex), rowAtIndex(modelIndex))A cell is simply a https:// that combines row and column into a single type.
that point.x will map to the column, and point.y will map to the row.
This method was introduced in Qt 6.4.
Point cellAtPosition(point position, bool includeSpacing)▲
Returns the cell at the given position in the table. position should be relative to the https://. If no https:// cell intersects with position, the return value will be point(-1, -1).
If includeSpacing is set to true, a cell's bounding box will be considered to include half the adjacent https:// and https:// on each side. The default value is false.
A https:// attached to a https:// installs itself on the https:// rather than the view. So the position reported by the handler can be used directly in a call to this function without any https://.
See Also▲
See also https://, https://
Point cellAtPosition(real x, real y, bool includeSpacing)▲
Convenience for calling cellAtPosition(Qt.point(x, y), includeSpacing).
[since 6.4] int columnAtIndex(QModelIndex modelIndex)▲
Returns the column in the view that maps to modelIndex in the model.
This method was introduced in Qt 6.4.
See Also▲
See also https://(), https://()
[since 6.2] real columnWidth(int column)▲
Returns the width of the given column. If the column is not loaded (and therefore not visible), the return value will be -1.
It's the applications responsibility to store what the column widths are, by using a https://. Hence, there is no setter function. This getter function is mostly useful if the https:// doesn't have a https:// set, since otherwise you can call that function instead (which will work, even for columns that are not currently visible). If no https:// is set, the width of a column will be equal to its https://().
This method was introduced in Qt 6.2.
See Also▲
See also https://, https://(), https://(), https://
forceLayout()▲
Responding to changes in the model are batched so that they are handled only once per frame. This means the https:// delays showing any changes while a script is being run. The same is also true when changing properties, such as https:// or https://.
This method forces the https:// to immediately update the layout so that any recent changes take effect.
Calling this function re-evaluates the size and position of each visible row and column. This is needed if the functions assigned to https:// or https:// return different values than what is already assigned.
[since 6.2] real implicitColumnWidth(int column)▲
Returns the implicit width of the given column. If the column is not loaded (and therefore not visible), the return value will be -1.
The implicit width of a column is the largest implicitWidth found among the currently loaded delegate items inside that column. Widths returned by the https:// will not be taken into account.
This method was introduced in Qt 6.2.
See Also▲
See also https://, https://(), https://(), https://
[since 6.2] real implicitRowHeight(int row)▲
Returns the implicit height of the given row. If the row is not loaded (and therefore not visible), the return value will be -1.
The implicit height of a row is the largest implicitHeight found among the currently loaded delegate items inside that row. Heights returned by the https:// will not be taken into account.
This method was introduced in Qt 6.2.
See Also▲
See also https://, https://(), https://(), https://
[since 6.4.3] QModelIndex index(int row, int column)▲
Returns the https:// that maps to row and column in the view.
row and column should be the row and column in the view (table row and table column), and not a row and column in the model. For a plain https://, this is equivalent of calling model.index(row, column). But for a subclass of https://, like https://, where the data model is wrapped inside an internal proxy model that flattens the tree structure into a table, you need to use this function to resolve the model index.
This method was introduced in Qt 6.4.3.
See Also▲
See also https://(), https://()
[since 6.2] bool isColumnLoaded(int column)▲
Returns true if the given column is loaded.
A column is loaded when https:// has loaded the delegate items needed to show the column inside the view. This also usually means that the column is visible for the user, but not always.
This function can be used whenever you need to iterate over the delegate items for a column, e.g from a https://, to be sure that the delegate items are available for iteration.
This method was introduced in Qt 6.2.
[since 6.2] bool isRowLoaded(int row)▲
Returns true if the given row is loaded.
A row is loaded when https:// has loaded the delegate items needed to show the row inside the view. This also usually means that the row is visible for the user, but not always.
This function can be used whenever you need to iterate over the delegate items for a row, e.g from a https://, to be sure that the delegate items are available for iteration.
This method was introduced in Qt 6.2.
Item itemAtCell(point cell)▲
Returns the delegate item at cell if loaded, otherwise null.
only the items that are visible in the view are normally loaded. As soon as a cell is flicked out of the view, the item inside will either be unloaded or placed in the recycle pool. As such, the return value should never be stored.
Item itemAtCell(int column, int row)▲
Convenience for calling itemAtCell(Qt.point(column, row)).
[since 6.4] QModelIndex modelIndex(point cell)▲
Convenience function for doing:
modelIndex(cell.y, cell.x)A cell is simply a https:// that combines row and column into a single type.
point.x will map to the column, and point.y will map to the row.
This method was introduced in Qt 6.4.
positionViewAtCell(point cell, PositionMode mode, point offset, rect subRect)▲
Positions https:// and https:// such that cell is at the position specified by mode. mode can be an or-ed combination of the following:
|
Constant |
Description |
|---|---|
|
TableView.AlignLeft |
Position the cell at the left of the view. |
|
TableView.AlignHCenter |
Position the cell at the horizontal center of the view. |
|
TableView.AlignRight |
Position the cell at the right of the view. |
|
TableView.AlignTop |
Position the cell at the top of the view. |
|
TableView.AlignVCenter |
Position the cell at the vertical center of the view. |
|
TableView.AlignBottom |
Position the cell at the bottom of the view. |
|
TableView.AlignCenter |
The same as (https://.AlignHCenter | https://.AlignVCenter) |
|
TableView.Visible |
If any part of the cell is visible then take no action. Otherwise move the content item so that the entire cell becomes visible. |
|
TableView.Contain |
If the entire cell is visible then take no action. Otherwise move the content item so that the entire cell becomes visible. If the cell is bigger than the view, the top-left part of the cell will be preferred. |
If no vertical alignment is specified, vertical positioning will be ignored. The same is true for horizontal alignment.
Optionally, you can specify offset to move contentX and contentY an extra number of pixels beyond the target alignment. E.g if you want to position the view so that cell [10, 10] ends up at the top-left corner with a 5px margin, you could do:
positionViewAtCell(Qt.point(10, 10), TableView.AlignLeft | TableView.AlignTop, Qt.point(-5, -5))As of Qt 6.4, you can specify a subRect to position on a rectangle inside the cell, rather than on the bounding rectangle of the whole cell. This can be useful if the cell is e.g larger than the view, and you want to ensure that a specific part of it is visible. The subRect needs to be https:// to be taken into consideration.
It is not recommended to use contentX or contentY to position the view at a particular cell. This is unreliable since removing items from the start of the table does not cause all other items to be repositioned. https:// can also sometimes place rows and columns at approximate positions to optimize for speed. The only exception is if the cell is already visible in the view, which can be checked upfront by calling https://().
Methods should only be called after the Component has completed. To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end:
Component.onCompleted: positionViewAtCell(Qt.point(columns - 1, rows - 1), TableView.AlignRight | TableView.AlignBottom)The second argument to this function used to be Qt.Alignment. For backwards compatibility, that enum can still be used. The change to use PositionMode was done in Qt 6.4.
See Also▲
See also https://
positionViewAtCell(int column, int row, PositionMode mode, point offset, rect subRect)▲
Positions https:// and https:// such that row and column is at the position specified by mode, offset and subRect.
Convenience for calling
positionViewAtCell(Qt.point(column, row), mode, offset, subRect)positionViewAtColumn(int column, PositionMode mode, real offset, rect subRect)▲
Positions {Flickable::}{contentX} such that column is at the position specified by mode, offset and subRect.
Convenience method for calling
positionViewAtCell(Qt.point(column, 0), mode & Qt.AlignHorizontal_Mask, offset, subRect)positionViewAtRow(int row, PositionMode mode, real offset, rect subRect)▲
Positions {Flickable::}{contentY} such that row is at the position specified by mode, offset and subRect.
Convenience method for calling
positionViewAtCell(Qt.point(0, row), mode & Qt.AlignVertical_Mask, offset, subRect)[since 6.4] int rowAtIndex(QModelIndex modelIndex)▲
Returns the row in the view that maps to modelIndex in the model.
This method was introduced in Qt 6.4.
See Also▲
See also https://(), https://()
[since 6.2] real rowHeight(int row)▲
Returns the height of the given row. If the row is not loaded (and therefore not visible), the return value will be -1.
It's the applications responsibility to store what the row heights are, by using a https://. Hence, there is no setter function. This getter function is mostly useful if the https:// doesn't have a https:// set, since otherwise you can call that function instead (which will work, even for rows that are not currently visible). If no https:// is set, the height of a row will be equal to its https://().
This method was introduced in Qt 6.2.
See Also▲
See also https://, https://(), https://(), https://
Obsolete Members for TableView▲
The following members of QML type https:// are deprecated. We strongly advise against using them in new code.
Obsolete Method Documentation▲
Point cellAtPos(point position, bool includeSpacing)▲
This method is deprecated. We strongly advise against using it in new code.
Use https://(point position) instead.
Point cellAtPos(real x, real y, bool includeSpacing)▲
This method is deprecated. We strongly advise against using it in new code.
Use https://(real x, real y) instead.
[since 6.4] QModelIndex modelIndex(int column, int row)▲
This method is deprecated. We strongly advise against using it in new code.
Use index(row, column) instead.
Because of an API incompatible change between Qt 6.4.0 and Qt 6.4.2, the order of row and column was specified in the opposite order. If you rely on the order to be modelIndex(column, row), you can set the environment variable QT_QUICK_TABLEVIEW_COMPAT_VERSION to 6.4
This method was introduced in Qt 6.4.


