39class Q_QUICK_EXPORT
QQuickTableView :
public QQuickFlickable,
public QQmlFinalizerHook
42 Q_INTERFACES(QQmlFinalizerHook)
44 Q_PROPERTY(
int rows READ rows NOTIFY rowsChanged)
45 Q_PROPERTY(
int columns READ columns NOTIFY columnsChanged)
46 Q_PROPERTY(qreal rowSpacing READ rowSpacing WRITE setRowSpacing NOTIFY rowSpacingChanged)
47 Q_PROPERTY(qreal columnSpacing READ columnSpacing WRITE setColumnSpacing NOTIFY columnSpacingChanged)
48 Q_PROPERTY(QJSValue rowHeightProvider READ rowHeightProvider WRITE setRowHeightProvider NOTIFY rowHeightProviderChanged)
49 Q_PROPERTY(QJSValue columnWidthProvider READ columnWidthProvider WRITE setColumnWidthProvider NOTIFY columnWidthProviderChanged)
50 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
51 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
52 Q_PROPERTY(
bool reuseItems READ reuseItems WRITE setReuseItems NOTIFY reuseItemsChanged)
53 Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged OVERRIDE)
54 Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged OVERRIDE)
55 Q_PROPERTY(QQuickTableView *syncView READ syncView WRITE setSyncView NOTIFY syncViewChanged REVISION(2, 14))
56 Q_PROPERTY(Qt::Orientations syncDirection READ syncDirection WRITE setSyncDirection NOTIFY syncDirectionChanged REVISION(2, 14))
57 Q_PROPERTY(
int leftColumn READ leftColumn NOTIFY leftColumnChanged REVISION(6, 0))
58 Q_PROPERTY(
int rightColumn READ rightColumn NOTIFY rightColumnChanged REVISION(6, 0))
59 Q_PROPERTY(
int topRow READ topRow NOTIFY topRowChanged REVISION(6, 0))
60 Q_PROPERTY(
int bottomRow READ bottomRow NOTIFY bottomRowChanged REVISION(6, 0))
61 Q_PROPERTY(QItemSelectionModel *selectionModel READ selectionModel WRITE setSelectionModel NOTIFY selectionModelChanged REVISION(6, 2))
62 Q_PROPERTY(
bool animate READ animate WRITE setAnimate NOTIFY animateChanged REVISION(6, 4))
63 Q_PROPERTY(
bool keyNavigationEnabled READ keyNavigationEnabled WRITE setKeyNavigationEnabled NOTIFY keyNavigationEnabledChanged REVISION(6, 4))
64 Q_PROPERTY(
bool pointerNavigationEnabled READ pointerNavigationEnabled WRITE setPointerNavigationEnabled NOTIFY pointerNavigationEnabledChanged REVISION(6, 4))
65 Q_PROPERTY(
int currentRow READ currentRow NOTIFY currentRowChanged REVISION(6, 4) FINAL)
66 Q_PROPERTY(
int currentColumn READ currentColumn NOTIFY currentColumnChanged REVISION(6, 4) FINAL)
67 Q_PROPERTY(
bool alternatingRows READ alternatingRows WRITE setAlternatingRows NOTIFY alternatingRowsChanged REVISION(6, 4) FINAL)
68 Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior NOTIFY selectionBehaviorChanged REVISION(6, 4) FINAL)
69 Q_PROPERTY(
bool resizableColumns READ resizableColumns WRITE setResizableColumns NOTIFY resizableColumnsChanged REVISION(6, 5) FINAL)
70 Q_PROPERTY(
bool resizableRows READ resizableRows WRITE setResizableRows NOTIFY resizableRowsChanged REVISION(6, 5) FINAL)
71 Q_PROPERTY(EditTriggers editTriggers READ editTriggers WRITE setEditTriggers NOTIFY editTriggersChanged REVISION(6, 5) FINAL)
72 Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode NOTIFY selectionModeChanged REVISION(6, 6) FINAL)
73 Q_PROPERTY(QQmlDelegateModel::DelegateModelAccess delegateModelAccess READ delegateModelAccess
74 WRITE setDelegateModelAccess NOTIFY delegateModelAccessChanged REVISION(6, 10) FINAL)
76 QML_NAMED_ELEMENT(TableView)
77 QML_ADDED_IN_VERSION(2, 12)
78 QML_ATTACHED(QQuickTableViewAttached)
81 enum SelectionBehavior {
87 Q_ENUM(SelectionBehavior)
100 SelectedTapped = 0x4,
101 EditKeyPressed = 0x8,
102 AnyKeyPressed = 0x10,
104 Q_DECLARE_FLAGS(EditTriggers, EditTrigger)
107 QQuickTableView(QQuickItem *parent =
nullptr);
108 ~QQuickTableView() override;
112 qreal rowSpacing()
const;
113 void setRowSpacing(qreal spacing);
115 qreal columnSpacing()
const;
116 void setColumnSpacing(qreal spacing);
118 QJSValue rowHeightProvider()
const;
119 void setRowHeightProvider(
const QJSValue &provider);
121 QJSValue columnWidthProvider()
const;
122 void setColumnWidthProvider(
const QJSValue &provider);
124 QVariant model()
const;
125 void setModel(
const QVariant &newModel);
127 QQmlComponent *delegate()
const;
128 void setDelegate(QQmlComponent *);
130 bool reuseItems()
const;
131 void setReuseItems(
bool reuseItems);
133 void setContentWidth(qreal width);
134 void setContentHeight(qreal height);
136 QQuickTableView *syncView()
const;
137 void setSyncView(QQuickTableView *view);
139 Qt::Orientations syncDirection()
const;
140 void setSyncDirection(Qt::Orientations direction);
142 QItemSelectionModel *selectionModel()
const;
143 void setSelectionModel(QItemSelectionModel *selectionModel);
145 bool animate()
const;
146 void setAnimate(
bool animate);
148 bool keyNavigationEnabled()
const;
149 void setKeyNavigationEnabled(
bool enabled);
150 bool pointerNavigationEnabled()
const;
151 void setPointerNavigationEnabled(
bool enabled);
153 int leftColumn()
const;
154 int rightColumn()
const;
156 int bottomRow()
const;
158 int currentRow()
const;
159 int currentColumn()
const;
161 bool alternatingRows()
const;
162 void setAlternatingRows(
bool alternatingRows);
164 SelectionBehavior selectionBehavior()
const;
165 void setSelectionBehavior(SelectionBehavior selectionBehavior);
166 SelectionMode selectionMode()
const;
167 void setSelectionMode(SelectionMode selectionMode);
169 bool resizableColumns()
const;
170 void setResizableColumns(
bool enabled);
172 bool resizableRows()
const;
173 void setResizableRows(
bool enabled);
175 EditTriggers editTriggers()
const;
176 void setEditTriggers(EditTriggers editTriggers);
178 QQmlDelegateModel::DelegateModelAccess delegateModelAccess()
const;
179 void setDelegateModelAccess(QQmlDelegateModel::DelegateModelAccess delegateModelAccess);
181 Q_INVOKABLE
void forceLayout();
182 Q_INVOKABLE
void positionViewAtCell(
const QPoint &cell, QQuickTableView::PositionMode mode,
const QPointF &offset = QPointF(),
const QRectF &subRect = QRectF());
183 Q_INVOKABLE
void positionViewAtIndex(
const QModelIndex &index, QQuickTableView::PositionMode mode,
const QPointF &offset = QPointF(),
const QRectF &subRect = QRectF());
184 Q_INVOKABLE
void positionViewAtRow(
int row, QQuickTableView::PositionMode mode, qreal offset = 0,
const QRectF &subRect = QRectF());
185 Q_INVOKABLE
void positionViewAtColumn(
int column, QQuickTableView::PositionMode mode, qreal offset = 0,
const QRectF &subRect = QRectF());
186 Q_INVOKABLE QQuickItem *itemAtCell(
const QPoint &cell)
const;
188 Q_REVISION(6, 4) Q_INVOKABLE QPoint cellAtPosition(
const QPointF &position,
bool includeSpacing =
false)
const;
189 Q_REVISION(6, 4) Q_INVOKABLE QPoint cellAtPosition(qreal x, qreal y,
bool includeSpacing =
false)
const;
190#if QT_DEPRECATED_SINCE(6
, 4
)
191 QT_DEPRECATED_VERSION_X_6_4(
"Use index(row, column) instead")
192 Q_REVISION(6, 4) Q_INVOKABLE
virtual QModelIndex modelIndex(
int row,
int column)
const;
193 QT_DEPRECATED_VERSION_X_6_4(
"Use cellAtPosition() instead")
194 Q_INVOKABLE QPoint cellAtPos(
const QPointF &position,
bool includeSpacing =
false)
const;
195 Q_INVOKABLE QPoint cellAtPos(qreal x, qreal y,
bool includeSpacing =
false)
const;
198 Q_REVISION(6, 2) Q_INVOKABLE
bool isColumnLoaded(
int column)
const;
199 Q_REVISION(6, 2) Q_INVOKABLE
bool isRowLoaded(
int row)
const;
201 Q_REVISION(6, 2) Q_INVOKABLE qreal columnWidth(
int column)
const;
202 Q_REVISION(6, 2) Q_INVOKABLE qreal rowHeight(
int row)
const;
203 Q_REVISION(6, 2) Q_INVOKABLE qreal implicitColumnWidth(
int column)
const;
204 Q_REVISION(6, 2) Q_INVOKABLE qreal implicitRowHeight(
int row)
const;
206 Q_REVISION(6, 4) Q_INVOKABLE QModelIndex index(
int row,
int column)
const;
207 Q_REVISION(6, 4) Q_INVOKABLE
virtual QModelIndex modelIndex(
const QPoint &cell)
const;
208 Q_REVISION(6, 4) Q_INVOKABLE
virtual QPoint cellAtIndex(
const QModelIndex &index)
const;
209 Q_REVISION(6, 4) Q_INVOKABLE
int rowAtIndex(
const QModelIndex &index)
const;
210 Q_REVISION(6, 4) Q_INVOKABLE
int columnAtIndex(
const QModelIndex &index)
const;
212 Q_REVISION(6, 5) Q_INVOKABLE
void setColumnWidth(
int column, qreal size);
213 Q_REVISION(6, 5) Q_INVOKABLE
void clearColumnWidths();
214 Q_REVISION(6, 5) Q_INVOKABLE qreal explicitColumnWidth(
int column)
const;
216 Q_REVISION(6, 5) Q_INVOKABLE
void setRowHeight(
int row, qreal size);
217 Q_REVISION(6, 5) Q_INVOKABLE
void clearRowHeights();
218 Q_REVISION(6, 5) Q_INVOKABLE qreal explicitRowHeight(
int row)
const;
220 Q_REVISION(6, 5) Q_INVOKABLE
void edit(
const QModelIndex &index);
221 Q_REVISION(6, 5) Q_INVOKABLE
void closeEditor();
223 Q_REVISION(6, 5) Q_INVOKABLE QQuickItem *itemAtIndex(
const QModelIndex &index)
const;
225#if QT_DEPRECATED_SINCE(6
, 5
)
226 QT_DEPRECATED_VERSION_X_6_5(
"Use itemAtIndex(index(row, column)) instead")
227 Q_INVOKABLE QQuickItem *itemAtCell(
int column,
int row)
const;
228 QT_DEPRECATED_VERSION_X_6_5(
"Use positionViewAtIndex(index(row, column)) instead")
229 Q_INVOKABLE
void positionViewAtCell(
int column,
int row, QQuickTableView::PositionMode mode,
const QPointF &offset = QPointF(),
const QRectF &subRect = QRectF());
232 Q_REVISION(6, 8) Q_INVOKABLE
void moveColumn(
int source,
int destination);
233 Q_REVISION(6, 8) Q_INVOKABLE
void moveRow(
int source,
int destination);
234 Q_REVISION(6, 8) Q_INVOKABLE
void clearColumnReordering();
235 Q_REVISION(6, 8) Q_INVOKABLE
void clearRowReordering();
237 static QQuickTableViewAttached *qmlAttachedProperties(QObject *);
241 void columnsChanged();
242 void rowSpacingChanged();
243 void columnSpacingChanged();
244 void rowHeightProviderChanged();
245 void columnWidthProviderChanged();
247 void delegateChanged();
248 void reuseItemsChanged();
249 Q_REVISION(2, 14)
void syncViewChanged();
250 Q_REVISION(2, 14)
void syncDirectionChanged();
251 Q_REVISION(6, 0)
void leftColumnChanged();
252 Q_REVISION(6, 0)
void rightColumnChanged();
253 Q_REVISION(6, 0)
void topRowChanged();
254 Q_REVISION(6, 0)
void bottomRowChanged();
255 Q_REVISION(6, 2)
void selectionModelChanged();
256 Q_REVISION(6, 4)
void animateChanged();
257 Q_REVISION(6, 4)
void keyNavigationEnabledChanged();
258 Q_REVISION(6, 4)
void pointerNavigationEnabledChanged();
259 Q_REVISION(6, 4)
void currentRowChanged();
260 Q_REVISION(6, 4)
void currentColumnChanged();
261 Q_REVISION(6, 4)
void alternatingRowsChanged();
262 Q_REVISION(6, 4)
void selectionBehaviorChanged();
263 Q_REVISION(6, 5)
void resizableColumnsChanged();
264 Q_REVISION(6, 5)
void resizableRowsChanged();
265 Q_REVISION(6, 5)
void editTriggersChanged();
266 Q_REVISION(6, 5)
void layoutChanged();
267 Q_REVISION(6, 6)
void selectionModeChanged();
268 Q_REVISION(6, 8)
void rowMoved(
int logicalIndex,
int oldVisualIndex,
int newVisualIndex);
269 Q_REVISION(6, 8)
void columnMoved(
int logicalIndex,
int oldVisualIndex,
int newVisualIndex);
270 Q_REVISION(6, 10)
void delegateModelAccessChanged();
273 void geometryChange(
const QRectF &newGeometry,
const QRectF &oldGeometry) override;
274 void viewportMoved(Qt::Orientations orientation) override;
275 void keyPressEvent(QKeyEvent *e) override;
276 bool eventFilter(QObject *obj, QEvent *event) override;
279 QQuickTableView(QQuickTableViewPrivate &dd, QQuickItem *parent);
281 void componentFinalized() override;
284 Q_DISABLE_COPY(QQuickTableView)
285 Q_DECLARE_PRIVATE(QQuickTableView)
287 qreal minXExtent()
const override;
288 qreal maxXExtent()
const override;
289 qreal minYExtent()
const override;
290 qreal maxYExtent()
const override;