7#include <QtCore/qtimer.h>
8#include <QtCore/qdir.h>
9#include <QtQmlModels/private/qqmldelegatemodel_p.h>
10#include <QtQmlModels/private/qqmldelegatemodel_p_p.h>
11#include <QtQml/private/qqmlincubator_p.h>
12#include <QtQmlModels/private/qqmlchangeset_p.h>
13#include <QtQml/qqmlinfo.h>
15#include <QtQuick/private/qquickflickable_p_p.h>
16#include <QtQuick/private/qquickitemviewfxitem_p_p.h>
17#include <QtQuick/private/qquicktaphandler_p.h>
1453#define Q_TABLEVIEW_UNREACHABLE(output) { dumpTable(); qWarning() << "output:" << output; Q_UNREACHABLE(); }
1454#define Q_TABLEVIEW_ASSERT(cond, output) Q_ASSERT((cond) || [&](){ dumpTable(); qWarning() << "output:" << output; return false;}())
1478 return index <= startIndex;
1481 return index >= startIndex;
1485 const int s = std::min(startIndex, endIndex);
1486 const int e = std::max(startIndex, endIndex);
1508 if (
auto item = fxTableItem->item) {
1509 if (fxTableItem->ownItem)
1525 return QString(
QLatin1String(
"table cells: (%1,%2) -> (%3,%4), item count: %5, table rect: %6,%7 x %8,%9"))
1538 std::stable_sort(listCopy.begin(), listCopy.end(),
1540 { return lhs->index < rhs->index; });
1543 for (
int i = 0;
i < listCopy.size(); ++
i)
1559 if (!tableInstanceModel) {
1572 bool wasRequired =
false;
1587 if (propertyList.contains(propertyName)) {
1588 const auto metaObject =
object->metaObject();
1590 const auto metaProperty =
metaObject->property(propertyIndex);
1591 metaProperty.write(
object,
value);
1604 if (propertyList.contains(propertyName)) {
1607 const auto metaProperty =
metaObject->property(propertyIndex);
1627 qmlWarning(
q) <<
"Cannot start selection: TableView.selectionBehavior == TableView.SelectionDisabled";
1652 qmlWarning(q_func()) <<
"Cannot set selection: no SelectionModel assigned!";
1699 qmlWarning(q_func()) <<
"Cannot set selection: no SelectionModel assigned!";
1759 return q->cellAtPosition(clampedPos,
true);
1776 if (oldRect.
x() < newRect.
x()) {
1780 }
else if (oldRect.
x() + oldRect.
width() > newRect.
x() + newRect.
width()) {
1786 if (oldRect.
y() < newRect.
y()) {
1790 }
else if (oldRect.
y() + oldRect.
height() > newRect.
y() + newRect.
height()) {
1824 if (bottomRightCell.
x() < topLeftCell.
x())
1825 std::swap(topLeftCell.
rx(), bottomRightCell.
rx());
1827 std::swap(topLeftCell.
ry(), bottomRightCell.
ry());
1848 left =
q->contentWidth();
1853 top =
q->contentHeight();
1858 right =
q->contentWidth();
1897 if (remainingDist > 0 || !firstColumnLoaded) {
1899 if (firstColumnLoaded)
1900 stepX =
qMin(stepX, remainingDist);
1901 q->setContentX(
q->contentX() - stepX);
1904 }
else if (outsideRight) {
1907 if (remainingDist > 0 || !lastColumnLoaded) {
1909 if (lastColumnLoaded)
1910 stepX =
qMin(stepX, remainingDist);
1911 q->setContentX(
q->contentX() + stepX);
1919 if (remainingDist > 0 || !firstRowLoaded) {
1922 stepY =
qMin(stepY, remainingDist);
1923 q->setContentY(
q->contentY() - stepY);
1926 }
else if (outsideBottom) {
1929 if (remainingDist > 0 || !lastRowLoaded) {
1932 stepY =
qMin(stepY, remainingDist);
1933 q->setContentY(
q->contentY() + stepY);
1954 return (cell.
y() * availableColumns) + cell.
x();
1957 return (cell.
x() * availableRows) + cell.
y();
1968 int row = int(modelIndex / availableColumns);
1969 int column = modelIndex % availableColumns;
1973 int column = int(modelIndex / availableRows);
1974 int row = modelIndex % availableRows;
1983 const QPoint cell = q_func()->cellAtIndex(modelIndex);
1991 return int(
log2(
float(edge)));
2007 int startIndex = -1;
2025 if (cachedResult.containsIndex(edge, startIndex))
2031 int testIndex = startIndex;
2036 if (testIndex < 0) {
2042 foundIndex = testIndex;
2057 foundIndex = testIndex;
2066 if (testIndex < 0) {
2072 foundIndex = testIndex;
2087 foundIndex = testIndex;
2096 cachedResult.startIndex = startIndex;
2097 cachedResult.endIndex = foundIndex;
2131 q->QQuickFlickable::setContentWidth(0);
2139 const qreal estimatedRemainingWidth = remainingColumnWidths + remainingSpacing;
2143 q->QQuickFlickable::setContentWidth(estimatedWidth);
2167 q->QQuickFlickable::setContentHeight(0);
2175 const qreal estimatedRemainingHeight = remainingRowHeights + remainingSpacing;
2179 q->QQuickFlickable::setContentHeight(estimatedHeight);
2197 bool tableMovedHorizontally =
false;
2198 bool tableMovedVertically =
false;
2206 const auto syncView_d =
syncView->d_func();
2207 origin.
rx() = syncView_d->origin.x();
2222 tableMovedHorizontally =
true;
2231 const int columnsRemaining = nextLeftColumn + 1;
2234 const qreal estimatedRemainingWidth = remainingColumnWidths + remainingSpacing;
2250 tableMovedHorizontally =
true;
2259 const int columnsRemaining =
tableSize.
width() - nextRightColumn;
2262 const qreal estimatedRemainingWidth = remainingColumnWidths + remainingSpacing;
2264 endExtent.
rwidth() = pixelsOutsideContentWidth + estimatedRemainingWidth;
2269 const auto syncView_d =
syncView->d_func();
2270 origin.
ry() = syncView_d->origin.y();
2285 tableMovedVertically =
true;
2294 const int rowsRemaining = nextTopRow + 1;
2297 const qreal estimatedRemainingHeight = remainingRowHeights + remainingSpacing;
2313 tableMovedVertically =
true;
2325 const qreal estimatedRemainingHeight = remainingRowHeigts + remainingSpacing;
2327 endExtent.
rheight() = pixelsOutsideContentHeight + estimatedRemainingHeight;
2331 if (tableMovedHorizontally || tableMovedVertically) {
2340 auto syncChild_d = syncChild->d_func();
2342 if (tableMovedHorizontally)
2344 if (tableMovedVertically)
2428 if (wasVisibleFromBefore == isVisibleNow)
2433 qCDebug(lcTableViewDelegateLifecycle) <<
"Column" <<
column <<
"changed visibility to" << isVisibleNow;
2457 if (wasVisibleFromBefore == isVisibleNow)
2462 qCDebug(lcTableViewDelegateLifecycle) <<
"Row" <<
row <<
"changed visibility to" << isVisibleNow;
2499 const bool updated = rootView->d_func()->updateTableRecursive();
2501 qWarning() <<
"TableView::forceLayout(): Cannot do an immediate re-layout during an ongoing layout!";
2539 bool ownItem =
false;
2550 qWarning() <<
"TableView: failed loading index:" << modelIndex;
2559 qWarning() <<
"TableView: delegate is not an item:" << modelIndex;
2566 qmlWarning(
item) <<
"TableView: detected anchors on delegate with index: " << modelIndex
2567 <<
". Use implicitWidth and implicitHeight instead.";
2582 fxTableItem->
cell = cell;
2583 fxTableItem->
index = modelIndex;
2592 static const bool forcedAsync = forcedIncubationMode ==
QLatin1String(
"async");
2601 qCDebug(lcTableViewDelegateLifecycle) << cell <<
"ready?" << bool(
item);
2656 switch (tableEdge) {
2676 switch (tableEdge) {
2760 qreal columnWidth = 0;
2770 qreal rowHeight = 0;
2786 emit q->columnsChanged();
2788 emit q->rowsChanged();
2810 if (explicitColumnWidth >= 0)
2811 return explicitColumnWidth;
2825 if (
qIsNaN(columnWidth) || columnWidth <= 0) {
2828 qmlWarning(q_func()) <<
"the delegate's implicitWidth needs to be greater than zero";
2872 if (explicitRowHeight >= 0)
2873 return explicitRowHeight;
2877 return syncView->d_func()->getRowLayoutHeight(
row);
2887 if (
qIsNaN(rowHeight) || rowHeight <= 0) {
2890 qmlWarning(q_func()) <<
"the delegate's implicitHeight needs to be greater than zero";
2906 const int noExplicitColumnWidth = -1;
2918 qreal explicitColumnWidth =
q->explicitColumnWidth(
column);
2919 if (explicitColumnWidth >= 0)
2920 return explicitColumnWidth;
2921 return noExplicitColumnWidth;
2924 qreal columnWidth = noExplicitColumnWidth;
2929 if (
qIsNaN(columnWidth) || columnWidth < 0)
2930 columnWidth = noExplicitColumnWidth;
2934 qmlWarning(q_func()) <<
"columnWidthProvider doesn't contain a function";
2936 columnWidth = noExplicitColumnWidth;
2952 const int noExplicitRowHeight = -1;
2964 qreal explicitRowHeight =
q->explicitRowHeight(
row);
2965 if (explicitRowHeight >= 0)
2966 return explicitRowHeight;
2967 return noExplicitRowHeight;
2970 qreal rowHeight = noExplicitRowHeight;
2975 if (
qIsNaN(rowHeight) || rowHeight < 0)
2976 rowHeight = noExplicitRowHeight;
2980 qmlWarning(q_func()) <<
"rowHeightProvider doesn't contain a function";
2982 rowHeight = noExplicitRowHeight;
3005 contentX = columnX + subRect.
x() +
offset;
3010 contentX = columnX + subRect.
x() - centerDistance +
offset;
3018 contentX = columnX +
offset;
3023 contentX = columnX - centerDistance +
offset;
3028 contentX =
qBound(-
q->minXExtent(), contentX, -
q->maxXExtent());
3048 contentY = rowY + subRect.
y() +
offset;
3053 contentY = rowY + subRect.
y() - centerDistance +
offset;
3061 contentY = rowY +
offset;
3066 contentY = rowY - centerDistance +
offset;
3071 contentY =
qBound(-
q->minYExtent(), contentY, -
q->maxYExtent());
3092 qCDebug(lcTableViewDelegateLifecycle);
3096 qCDebug(lcTableViewDelegateLifecycle()) <<
"Skipping relayout, viewport has zero size";
3112 item->setGeometry(geometry);
3128 item->setGeometry(geometry);
3135 if (
Q_UNLIKELY(lcTableViewDelegateLifecycle().isDebugEnabled())) {
3147 int columnThatNeedsLayout;
3148 int neighbourColumn;
3157 columnX = neighbourItem->geometry().left() -
cellSpacing.
width() - columnWidth;
3169 const qreal rowY = neighbourItem->geometry().y();
3170 const qreal rowHeight = neighbourItem->geometry().height();
3172 fxTableItem->setGeometry(
QRectF(columnX, rowY, columnWidth, rowHeight));
3173 fxTableItem->setVisible(
true);
3175 qCDebug(lcTableViewDelegateLifecycle()) <<
"layout item:" <<
QPoint(columnThatNeedsLayout,
row) << fxTableItem->geometry();
3181 int rowThatNeedsLayout;
3185 rowThatNeedsLayout =
topRow();
3197 const qreal columnX = neighbourItem->geometry().x();
3198 const qreal columnWidth = neighbourItem->geometry().width();
3199 fxTableItem->item->setX(columnX);
3200 fxTableItem->item->setWidth(columnWidth);
3217 fxTableItem->item->setY(rowY);
3218 fxTableItem->item->setHeight(rowHeight);
3219 fxTableItem->setVisible(
true);
3221 qCDebug(lcTableViewDelegateLifecycle()) <<
"layout item:" <<
QPoint(
column, rowThatNeedsLayout) << fxTableItem->geometry();
3229 auto item = topLeftItem->item;
3234 qCDebug(lcTableViewDelegateLifecycle) <<
"geometry:" << topLeftItem->geometry();
3276 qCDebug(lcTableViewDelegateLifecycle()) <<
"all items loaded!";
3290 emit q->leftColumnChanged();
3293 emit q->rightColumnChanged();
3296 emit q->topRowChanged();
3299 emit q->bottomRowChanged();
3306 emit q->layoutChanged();
3312 qCDebug(lcTableViewDelegateLifecycle()) <<
"Load request completed!";
3313 qCDebug(lcTableViewDelegateLifecycle()) <<
"****************************************";
3321 if (
Q_UNLIKELY(lcTableViewDelegateLifecycle().isDebugEnabled())) {
3322 qCDebug(lcTableViewDelegateLifecycle()) <<
"begin rebuild:" <<
q;
3326 qCDebug(lcTableViewDelegateLifecycle()) <<
"RebuildOption::ViewportOnly, options:" <<
rebuildOptions;
3334 :
QMargins(
q->leftColumn(),
q->topRow(),
q->rightColumn(),
q->bottomRow());
3347 qCDebug(lcTableViewDelegateLifecycle()) <<
"no items loaded!";
3402 emit q->leftColumnChanged();
3404 emit q->rightColumnChanged();
3406 emit q->topRowChanged();
3408 emit q->bottomRowChanged();
3414 emit q->layoutChanged();
3417 qCDebug(lcTableViewDelegateLifecycle()) <<
"rebuild completed!";
3418 qCDebug(lcTableViewDelegateLifecycle()) <<
"################################################";
3419 qCDebug(lcTableViewDelegateLifecycle());
3453 const auto syncView_d =
syncView->d_func();
3455 if (syncView_d->loadedItems.isEmpty()) {
3456 topLeftCell.
rx() = 0;
3457 topLeftCell.
ry() = 0;
3462 const QPoint syncViewTopLeftCell(syncView_d->leftColumn(), syncView_d->topRow());
3463 const auto syncViewTopLeftFxItem = syncView_d->loadedTableItem(syncViewTopLeftCell);
3464 const QPointF syncViewTopLeftPos = syncViewTopLeftFxItem->geometry().topLeft();
3467 topLeftCell.
rx() = syncViewTopLeftCell.
x();
3468 topLeftPos.
rx() = syncViewTopLeftPos.
x();
3478 topLeftCell.
ry() = syncViewTopLeftCell.
y();
3479 topLeftPos.
ry() = syncViewTopLeftPos.
y();
3568 qCDebug(lcTableViewDelegateLifecycle()) <<
"initial top left cell:" << topLeft <<
", pos:" << topLeftPos;
3606 qCDebug(lcTableViewDelegateLifecycle()) <<
"no model found, leaving table empty";
3611 qCDebug(lcTableViewDelegateLifecycle()) <<
"empty model found, leaving table empty";
3616 qCDebug(lcTableViewDelegateLifecycle()) <<
"no delegate found, leaving table empty";
3621 qCDebug(lcTableViewDelegateLifecycle()) <<
"no visible row or column found, leaving table empty";
3626 qCDebug(lcTableViewDelegateLifecycle()) <<
"could not resolve top-left item, leaving table empty";
3631 qCDebug(lcTableViewDelegateLifecycle()) <<
"viewport has zero size, leaving table empty";
3719 const bool cancelVertically = positionVertically && !
syncVertically;
3722 if (cancelHorizontally && !
qFuzzyIsNull(
q->horizontalOvershoot())) {
3723 qCDebug(lcTableViewDelegateLifecycle()) <<
"cancelling overshoot horizontally:" <<
q->horizontalOvershoot();
3728 if (cancelVertically && !
qFuzzyIsNull(
q->verticalOvershoot())) {
3729 qCDebug(lcTableViewDelegateLifecycle()) <<
"cancelling overshoot vertically:" <<
q->verticalOvershoot();
3738 qCDebug(lcTableViewDelegateLifecycle) << edge;
3748 emit q->leftColumnChanged();
3757 emit q->rightColumnChanged();
3766 emit q->topRowChanged();
3775 emit q->bottomRowChanged();
3780 emit q->layoutChanged();
3788 qCDebug(lcTableViewDelegateLifecycle) << edge << edgeIndex << q_func();
3824 tableModified =
false;
3827 tableModified =
true;
3832 tableModified =
true;
3837 }
while (tableModified);
3880 const int minTime = int(std::ceil(
w >
h ?
qreal(
w + 1) /
h :
qreal(
h + 1) /
w));
3881 const int maxTime = minTime * 2;
3886 if (!q_func()->isComponentComplete()) {
3924 if (!updateComplete)
3929 auto syncChild_d = syncChild->d_func();
3937 const bool descendantUpdateComplete = syncChild_d->updateTableRecursive();
3938 if (!descendantUpdateComplete)
4010 const auto cppMetaObject =
data->propertyCache->firstCppMetaObject();
4014 return qmlTypeView.metaObjectRevision();
4062 const auto &selectedIndexes = selected.
indexes();
4063 const auto &deselectedIndexes = deselected.
indexes();
4064 for (
int i = 0;
i < selectedIndexes.size(); ++
i)
4066 for (
int i = 0;
i < deselectedIndexes.size(); ++
i)
4083 if (modelAsVariant.
userType() == qMetaTypeId<QJSValue>())
4085 return qvariant_cast<QAbstractItemModel *>(modelAsVariant);
4093 const int cellIndex = *
it;
4098 const bool editing =
editIndex == q_func()->modelIndex(cell);
4110 if (qaimInSelection && qaimInSelection != qaimInTableView)
4111 qmlWarning(q_func()) <<
"TableView.selectionModel.model differs from TableView.model";
4123 const QPoint currentCell =
q->cellAtIndex(currentIndex);
4126 emit q->currentColumnChanged();
4131 emit q->currentRowChanged();
4151 qCDebug(lcTableViewDelegateLifecycle) <<
"item done loading:"
4182 attached->setView(
q);
4190 emit attached->pooled();
4206 emit attached->reused();
4279 emit q_func()->modelChanged();
4294 if (effectiveModelVariant.
userType() == qMetaTypeId<QJSValue>())
4297 const auto instanceModel = qobject_cast<QQmlInstanceModel *>(qvariant_cast<QObject*>(effectiveModelVariant));
4299 if (instanceModel) {
4304 model = instanceModel;
4320 syncView->d_func()->syncChildren.removeOne(
q);
4329 qmlWarning(
q) <<
"TableView: recursive syncView connection detected!";
4383 const auto syncView_d =
syncView->d_func();
4384 if (!syncView_d->loadedItems.isEmpty()) {
4629 const qreal diffY =
qAbs(newContentY -
q->contentY());
4630 const qreal duration =
qBound(700., diffY * 5, 1500.);
4636 q->setContentY(newContentY);
4671 const qreal diffX =
qAbs(newContentX -
q->contentX());
4672 const qreal duration =
qBound(700., diffX * 5, 1500.);
4678 q->setContentX(newContentX);
4719 q->setContentX(contentX);
4733 q->setContentY(contentY);
4750 auto syncChild_d = syncChild->d_func();
4751 if (syncChild_d->syncHorizontally)
4752 w =
qMax(
w, syncChild->width());
4753 if (syncChild_d->syncHorizontally)
4754 h =
qMax(
h, syncChild->height());
4765 q->setActiveFocusOnTab(
true);
4789 if (!tapHandler->isPressed())
4795 if (!
q->isInteractive())
4800 if (
q->isInteractive())
4808 if (resizeRow || resizeColumn) {
4814 const QPointF pos = tapHandler->point().pressPosition();
4840 bool tappedCellIsSelected =
false;
4845 if (
canEdit(tappedIndex,
false)) {
4849 q->edit(tappedIndex);
4852 q->edit(tappedIndex);
4875 qmlWarning(
q) <<
"cannot edit: index is not valid!";
4882 qmlWarning(
q) <<
"cannot edit: QAbstractItemModel::flags(index) doesn't contain Qt::ItemIsEditable";
4887 const QPoint cell =
q->cellAtIndex(tappedIndex);
4891 qmlWarning(
q) <<
"cannot edit: the cell to edit is not inside the viewport!";
4896 if (!attached || !attached->editDelegate()) {
4898 qmlWarning(
q) <<
"cannot edit: no TableView.editDelegate set!";
4911 auto syncView_d =
syncView->d_func();
4912 if (!syncView_d->inSyncViewportPosRecursive) {
4914 syncView_d->setLocalViewportX(
q->contentX());
4916 syncView_d->setLocalViewportY(
q->contentY());
4917 syncView_d->syncViewportPosRecursive();
4922 auto syncChild_d = syncChild->d_func();
4923 if (!syncChild_d->inSyncViewportPosRecursive) {
4924 if (syncChild_d->syncHorizontally)
4925 syncChild_d->setLocalViewportX(
q->contentX());
4926 if (syncChild_d->syncVertically)
4927 syncChild_d->setLocalViewportY(
q->contentY());
4928 syncChild_d->syncViewportPosRecursive();
4949 const auto index = q_func()->modelIndex(cell);
4961 const QPoint currentCell =
q->cellAtIndex(currentIndex);
4964 if (!
q->activeFocusOnTab()) {
4993 auto beginMoveCurrentIndex = [&](){
5005 auto endMoveCurrentIndex = [&](
const QPoint &cell){
5020 beginMoveCurrentIndex();
5026 endMoveCurrentIndex({currentCell.
x(), nextRow});
5029 beginMoveCurrentIndex();
5035 endMoveCurrentIndex({currentCell.
x(), nextRow});
5038 beginMoveCurrentIndex();
5044 endMoveCurrentIndex({nextColumn, currentCell.
y()});
5047 beginMoveCurrentIndex();
5053 endMoveCurrentIndex({nextColumn, currentCell.
y()});
5056 int newBottomRow = -1;
5057 beginMoveCurrentIndex();
5070 endMoveCurrentIndex(
QPoint(currentCell.
x(), newBottomRow));
5074 beginMoveCurrentIndex();
5075 if (currentCell.
y() >
topRow()) {
5087 endMoveCurrentIndex(
QPoint(currentCell.
x(), newTopRow));
5090 beginMoveCurrentIndex();
5093 endMoveCurrentIndex(
QPoint(firstColumn, currentCell.
y()));
5096 beginMoveCurrentIndex();
5099 endMoveCurrentIndex(
QPoint(lastColumn, currentCell.
y()));
5102 beginMoveCurrentIndex();
5103 int nextRow = currentCell.
y();
5116 marginX =
q->leftMargin();
5118 marginX = -
q->leftMargin();
5121 endMoveCurrentIndex({nextColumn, nextRow});
5124 beginMoveCurrentIndex();
5125 int nextRow = currentCell.
y();
5138 marginX =
q->leftMargin();
5140 marginX = -
q->leftMargin();
5143 endMoveCurrentIndex({nextColumn, nextRow});
5168 if (!attached || !attached->editDelegate())
5171 bool anyKeyPressed =
false;
5172 bool editKeyPressed =
false;
5180 anyKeyPressed =
true;
5181 editKeyPressed =
true;
5191 anyKeyPressed =
true;
5197 if (!(editKeyAccepted || anyKeyAccepted))
5218#if QT_CONFIG(cursor)
5219void QQuickTableViewPrivate::updateCursor()
5243 qApp->changeOverrideCursor(shape);
5245 qApp->setOverrideCursor(shape);
5248 }
else if (m_cursorSet) {
5249 qApp->restoreOverrideCursor();
5250 m_cursorSet =
false;
5263 auto cellItem =
q->itemAtCell(cell);
5309 qCDebug(lcTableViewDelegateLifecycle);
5335 return d_func()->tableSize.height();
5340 return d_func()->tableSize.width();
5345 return d_func()->cellSpacing.height();
5364 return d_func()->cellSpacing.width();
5383 return d_func()->rowHeightProvider;
5392 d->rowHeightProvider = provider;
5400 return d_func()->columnWidthProvider;
5409 d->columnWidthProvider = provider;
5417 return d_func()->modelImpl();
5425 d->setModelImpl(newModel);
5427 if (
d->selectionModel)
5428 d->selectionModel->setModel(
d->qaim(newModel));
5433 return d_func()->assignedDelegate;
5439 if (newDelegate ==
d->assignedDelegate)
5442 d->assignedDelegate = newDelegate;
5450 return d_func()->editTriggers;
5461 emit editTriggersChanged();
5477 if (!reuse &&
d->tableModel) {
5480 d->tableModel->drainReusableItemsPool(0);
5489 d->explicitContentWidth =
width;
5496 d->explicitContentHeight =
height;
5519 return d_func()->assignedSyncView;
5525 if (
d->assignedSyncView ==
view)
5528 d->assignedSyncView =
view;
5531 emit syncViewChanged();
5554 return d_func()->assignedSyncDirection;
5564 if (
d->assignedSyncView)
5567 emit syncDirectionChanged();
5572 return d_func()->selectionModel;
5585 if (
d->selectionModel) {
5594 if (
d->selectionModel) {
5595 d->selectionModel->setModel(
d->qaim(
d->modelImpl()));
5602 d->updateSelectedOnAllDelegateItems();
5604 emit selectionModelChanged();
5609 return d_func()->animate;
5620 d->positionXAnimation.stop();
5621 d->positionYAnimation.stop();
5624 emit animateChanged();
5629 return d_func()->keyNavigationEnabled;
5635 if (
d->keyNavigationEnabled ==
enabled)
5640 emit keyNavigationEnabledChanged();
5645 return d_func()->pointerNavigationEnabled;
5651 if (
d->pointerNavigationEnabled ==
enabled)
5654 d->pointerNavigationEnabled =
enabled;
5656 emit pointerNavigationEnabledChanged();
5662 return d->loadedItems.isEmpty() ? -1 : d_func()->leftColumn();
5668 return d->loadedItems.isEmpty() ? -1 : d_func()->rightColumn();
5674 return d->loadedItems.isEmpty() ? -1 : d_func()->topRow();
5680 return d->loadedItems.isEmpty() ? -1 : d_func()->bottomRow();
5685 return d_func()->currentRow;
5690 return d_func()->currentColumn;
5696 if (row < 0 || row >=
rows() ||
d->loadedRows.isEmpty())
5705 d->positionViewAtRow(
row, Qt::Alignment(
int(
mode)),
offset, subRect);
5715 const qreal subRectTop =
d->loadedTableOuterRect.top() + subRect.
top();
5716 const qreal subRectBottom =
d->loadedTableOuterRect.top() + subRect.
bottom();
5717 if (subRectTop < d->viewportRect.y())
5719 else if (subRectBottom >
d->viewportRect.bottom())
5728 const qreal subRectBottom =
d->loadedTableInnerRect.bottom() + subRect.
bottom();
5729 if (subRectBottom >
d->viewportRect.bottom())
5738 }
else if (subRect.
isValid()) {
5740 const qreal subRectTop =
d->loadedTableOuterRect.top() + subRect.
top();
5741 const qreal subRectBottom =
d->loadedTableOuterRect.top() + subRect.
bottom();
5742 if (subRectBottom < d->viewportRect.top())
5744 else if (subRectTop >
d->viewportRect.bottom())
5749 const qreal subRectTop =
d->loadedTableInnerRect.bottom() + subRect.
top();
5750 if (subRectTop >
d->viewportRect.bottom())
5762 if (column < 0 || column >=
columns() ||
d->loadedColumns.isEmpty())
5781 const qreal subRectLeft =
d->loadedTableOuterRect.left() + subRect.
left();
5782 const qreal subRectRight =
d->loadedTableOuterRect.left() + subRect.
right();
5783 if (subRectLeft < d->viewportRect.left())
5785 else if (subRectRight >
d->viewportRect.right())
5794 const qreal subRectRight =
d->loadedTableInnerRect.right() + subRect.
right();
5795 if (subRectRight >
d->viewportRect.right())
5804 }
else if (subRect.
isValid()) {
5806 const qreal subRectLeft =
d->loadedTableOuterRect.left() + subRect.
left();
5807 const qreal subRectRight =
d->loadedTableOuterRect.left() + subRect.
right();
5808 if (subRectRight < d->viewportRect.left())
5810 else if (subRectLeft >
d->viewportRect.right())
5815 const qreal subRectLeft =
d->loadedTableInnerRect.right() + subRect.
left();
5816 if (subRectLeft >
d->viewportRect.right())
5829 if (!horizontalMode && !verticalMode) {
5844 if (!horizontalMode && !verticalMode) {
5855#if QT_DEPRECATED_SINCE(6, 5)
5860 if (!horizontalMode && !verticalMode) {
5875 const int modelIndex =
d->modelIndexAtCell(cell);
5876 if (!
d->loadedItems.contains(modelIndex))
5878 return d->loadedItems.value(modelIndex)->item;
5881#if QT_DEPRECATED_SINCE(6, 5)
5891 const int serializedIndex =
d->modelIndexToCellIndex(
index);
5892 if (!
d->loadedItems.contains(serializedIndex))
5894 return d->loadedItems.value(serializedIndex)->item;
5897#if QT_DEPRECATED_SINCE(6, 4)
5918 if (!
d->loadedTableOuterRect.contains(
position))
5921 const qreal hSpace =
d->cellSpacing.width();
5922 const qreal vSpace =
d->cellSpacing.height();
5923 qreal currentColumnEnd =
d->loadedTableOuterRect.x();
5924 qreal currentRowEnd =
d->loadedTableOuterRect.y();
5926 int foundColumn = -1;
5929 for (
const int column :
d->loadedColumns) {
5930 currentColumnEnd +=
d->getEffectiveColumnWidth(
column);
5935 currentColumnEnd += hSpace;
5945 for (
const int row :
d->loadedRows) {
5946 currentRowEnd +=
d->getEffectiveRowHeight(
row);
5951 currentRowEnd += vSpace;
5962 return QPoint(foundColumn, foundRow);
5965bool QQuickTableView::isColumnLoaded(
int column)
const
5968 if (!
d->loadedColumns.contains(
column))
5981bool QQuickTableView::isRowLoaded(
int row)
const
5984 if (!
d->loadedRows.contains(
row))
5997qreal QQuickTableView::columnWidth(
int column)
const
6000 if (!isColumnLoaded(
column))
6003 return d->getEffectiveColumnWidth(
column);
6006qreal QQuickTableView::rowHeight(
int row)
const
6009 if (!isRowLoaded(
row))
6012 return d->getEffectiveRowHeight(
row);
6015qreal QQuickTableView::implicitColumnWidth(
int column)
const
6018 if (!isColumnLoaded(
column))
6021 return d->sizeHintForColumn(
column);
6024qreal QQuickTableView::implicitRowHeight(
int row)
const
6027 if (!isRowLoaded(
row))
6030 return d->sizeHintForRow(
row);
6037 qmlWarning(
this) <<
"column must be greather than, or equal to, zero";
6041 if (
d->syncHorizontally) {
6050 d->explicitColumnWidths.remove(
column);
6054 if (
d->loadedItems.isEmpty())
6059 d->forceLayout(
false);
6062void QQuickTableView::clearColumnWidths()
6066 if (
d->syncHorizontally) {
6067 d->syncView->clearColumnWidths();
6071 if (
d->explicitColumnWidths.isEmpty())
6074 d->explicitColumnWidths.clear();
6075 d->forceLayout(
false);
6078qreal QQuickTableView::explicitColumnWidth(
int column)
const
6082 if (
d->syncHorizontally)
6083 return d->syncView->explicitColumnWidth(
column);
6085 const auto it =
d->explicitColumnWidths.constFind(
column);
6086 if (
it !=
d->explicitColumnWidths.constEnd())
6095 qmlWarning(
this) <<
"row must be greather than, or equal to, zero";
6099 if (
d->syncVertically) {
6100 d->syncView->setRowHeight(
row,
size);
6108 d->explicitRowHeights.remove(
row);
6110 d->explicitRowHeights.insert(
row,
size);
6112 if (
d->loadedItems.isEmpty())
6117 d->forceLayout(
false);
6120void QQuickTableView::clearRowHeights()
6124 if (
d->syncVertically) {
6125 d->syncView->clearRowHeights();
6129 if (
d->explicitRowHeights.isEmpty())
6132 d->explicitRowHeights.clear();
6133 d->forceLayout(
false);
6136qreal QQuickTableView::explicitRowHeight(
int row)
const
6140 if (
d->syncVertically)
6141 return d->syncView->explicitRowHeight(
row);
6143 const auto it =
d->explicitRowHeights.constFind(
row);
6144 if (
it !=
d->explicitRowHeights.constEnd())
6152 if (cell.
x() < 0 || cell.
x() >=
columns() || cell.
y() < 0 || cell.
y() >=
rows())
6155 auto const qaim =
d->model->abstractItemModel();
6159 return qaim->index(cell.
y(), cell.
x());
6164 if (!
index.isValid() ||
index.parent().isValid())
6169#if QT_DEPRECATED_SINCE(6, 4)
6180 qmlWarning(
this) <<
"modelIndex(row, column) is deprecated. "
6181 "Use index(row, column) instead. For more information, see "
6182 "https://doc.qt.io/qt-6/qml-qtquick-tableview-obsolete.html";
6195 return cellAtIndex(
index).y();
6200 return cellAtIndex(
index).x();
6205 d_func()->forceLayout(
true);
6212 if (!
d->canEdit(
index,
true))
6215 if (
d->editIndex ==
index)
6221 if (!
d->editModel) {
6223 d->editModel->useImportVersion(
d->resolveImportVersion());
6225 [
this, d] (
int serializedModelIndex,
QObject *
object) {
6231 d->editIndex = modelIndex(d->cellAtModelIndex(serializedModelIndex));
6232 d->editItem = qmlobject_cast<QQuickItem*>(object);
6236 d->initItemCallback(serializedModelIndex, object);
6237 const auto cellItem = itemAtCell(cellAtIndex(d->editIndex));
6239 d->editItem->setParentItem(cellItem);
6246 if (
d->selectionModel)
6249 if (
d->editIndex.isValid())
6254 const auto attached =
d->getAttachedObject(cellItem);
6257 d->editModel->setModel(
d->tableModel->model());
6258 d->editModel->setDelegate(attached->editDelegate());
6260 const int cellIndex =
d->modelIndexToCellIndex(
index);
6264 d->editItem =
nullptr;
6265 qmlWarning(
this) <<
"cannot edit: TableView.editDelegate could not be instantiated!";
6272 qmlWarning(
this) <<
"cannot edit: TableView.editDelegate is not an Item!";
6273 d->editItem =
nullptr;
6292 if (
QObject *focusObject =
d->editItem->window()->focusObject()) {
6294 if (focusItem ==
d->editItem ||
d->editItem->isAncestorOf(focusItem))
6299void QQuickTableView::closeEditor()
6308 d->editItem =
nullptr;
6311 const int cellIndex =
d->modelIndexToCellIndex(
d->editIndex);
6316 if (
d->editIndex.isValid()) {
6333 if (
d->tableModel) {
6336 d->tableModel->drainReusableItemsPool(0);
6339 d->forceLayout(
false);
6351 if (
d->inSetLocalViewportPos)
6358 d->syncViewportPosRecursive();
6360 auto rootView =
d->rootSyncView();
6361 auto rootView_d = rootView->d_func();
6363 rootView_d->scheduleRebuildIfFastFlick();
6365 if (!rootView_d->polishScheduled) {
6366 if (rootView_d->scheduledRebuildOptions) {
6373 const bool updated = rootView->d_func()->updateTableRecursive();
6387 if (!
d->keyNavigationEnabled) {
6392 if (
d->tableSize.isEmpty())
6395 if (
d->editIndex.isValid()) {
6401 if (
d->setCurrentIndexFromKeyEvent(
e))
6404 if (
d->editFromKeyEvent(
e))
6417 switch (keyEvent->
key()) {
6420 if (
auto attached =
d->getAttachedObject(
d->editItem))
6421 emit attached->commit();
6427 if (
auto attached =
d->getAttachedObject(
d->editItem))
6428 emit attached->commit();
6430 if (
d->setCurrentIndexFromKeyEvent(keyEvent)) {
6431 const QModelIndex currentIndex =
d->selectionModel->currentIndex();
6432 if (
d->canEdit(currentIndex,
false))
6449 return d_func()->alternatingRows;
6459 emit alternatingRowsChanged();
6464 return d_func()->selectionBehavior;
6474 emit selectionBehaviorChanged();
6479 return d_func()->selectionMode;
6489 emit selectionModeChanged();
6494 return d_func()->resizableColumns;
6500 if (
d->resizableColumns ==
enabled)
6504 d->resizeHandler->setEnabled(
d->resizableRows ||
d->resizableColumns);
6505 d->hoverHandler->setEnabled(
d->resizableRows ||
d->resizableColumns);
6507 emit resizableColumnsChanged();
6512 return d_func()->resizableRows;
6522 d->resizeHandler->setEnabled(
d->resizableRows ||
d->resizableColumns);
6523 d->hoverHandler->setEnabled(
d->resizableRows ||
d->resizableColumns);
6525 emit resizableRowsChanged();
6540#if QT_CONFIG(cursor)
6543 tableViewPrivate->updateCursor();
6553#if QT_CONFIG(cursor)
6558 const auto item = tableView->itemAtCell(cell);
6562#if QT_CONFIG(cursor)
6563 tableViewPrivate->updateCursor();
6569 const bool hoveringRow = (itemPos.
y() <
margin() || itemPos.
y() >
item->height() -
margin());
6570 const bool hoveringColumn = (itemPos.
x() <
margin() || itemPos.
x() >
item->width() -
margin());
6571 m_row = hoveringRow ? itemPos.
y() <
margin() ? cell.
y() - 1 : cell.
y() : -1;
6572 m_column = hoveringColumn ? itemPos.
x() <
margin() ? cell.
x() - 1 : cell.
x() : -1;
6573#if QT_CONFIG(cursor)
6574 tableViewPrivate->updateCursor();
6597 switch (transition) {
6642 m_row = tableViewPrivate->resizableRows ? tableViewPrivate->hoverHandler->m_row : -1;
6643 m_column = tableViewPrivate->resizableColumns ? tableViewPrivate->hoverHandler->m_column : -1;
6658 const qreal dragDist =
qSqrt(distX * distX + distY * distY);
6659 if (dragDist >
qApp->styleHints()->startDragDistance())
6678#if QT_CONFIG(cursor)
6690 tableView->setFiltersChildMouseEvents(
false);
6698#if QT_CONFIG(cursor)
6699 tableViewPrivate->updateCursor();
6711 tableView->setFiltersChildMouseEvents(
true);
6712#if QT_CONFIG(cursor)
6713 tableViewPrivate->updateCursor();
6736#include "moc_qquicktableview_p.cpp"
6737#include "moc_qquicktableview_p_p.cpp"
void rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow, QPrivateSignal)
void columnsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after columns have been removed from the model.
LayoutChangeHint
This enum describes the way the model changes layout.
virtual Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const
Returns the item flags for the given index.
void modelReset(QPrivateSignal)
void layoutChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
void rowsInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after rows have been inserted into the model.
void columnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn, QPrivateSignal)
void columnsInserted(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after columns have been inserted into the model.
virtual Q_INVOKABLE QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const =0
Returns the index of the item in the model specified by the given row, column and parent index.
void rowsRemoved(const QModelIndex &parent, int first, int last, QPrivateSignal)
This signal is emitted after rows have been removed from the model.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QDir current()
Returns the application's current directory.
QString absoluteFilePath(const QString &fileName) const
Returns the absolute path name of a file in the directory.
The QEventPoint class provides information about a point in a QPointerEvent.
QGraphicsWidget * window() const
QPointF mapFromItem(const QGraphicsItem *item, const QPointF &point) const
Maps the point point, which is in item's coordinate system, to this item's coordinate system,...
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
QGraphicsItem * parentItem() const
Returns a pointer to this item's parent item.
void setVisible(bool visible)
If visible is true, the item is made visible.
bool isAncestorOf(const QGraphicsItem *child) const
Returns true if this item is an ancestor of child (i.e., if this item is child's parent,...
static QObject * focusObject()
Returns the QObject in currently active window that will be final receiver of events tied to focus,...
key_iterator keyEnd() const noexcept
qsizetype size() const noexcept
Returns the number of items in the hash.
QList< T > values() const
Returns a list containing all the values in the hash, in an arbitrary order.
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
key_iterator keyBegin() const noexcept
T value(const Key &key) const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
This signal is emitted whenever the selection changes.
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
This signal is emitted whenever the current item changes.
Q_INVOKABLE bool isSelected(const QModelIndex &index) const
Returns true if the given model item index is selected.
virtual void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Sets the model item index to be the current item, and emits currentChanged().
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
Selects the model item index using the specified command, and emits selectionChanged().
QAbstractItemModel * model
Q_CORE_EXPORT QModelIndexList indexes() const
Returns a list of model indexes that correspond to the selected items.
The QJSValue class acts as a container for Qt/JavaScript data types.
bool isCallable() const
Returns true if this QJSValue is a function, otherwise returns false.
QJSValue call(const QJSValueList &args=QJSValueList()) const
Calls this QJSValue as a function, passing args as arguments to the function, and using the globalObj...
double toNumber() const
Returns the number value of this QJSValue, as defined in \l{ECMA-262} section 9.3,...
bool isUndefined() const
Returns true if this QJSValue is of the primitive type Undefined or if the managed value has been cle...
bool strictlyEquals(const QJSValue &other) const
Returns true if this QJSValue is equal to other using strict comparison (no conversion),...
The QKeyEvent class describes a key event.
int key() const
Returns the code of the key that was pressed or released.
const_reference at(qsizetype i) const noexcept
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
const Container & values() const &
bool contains(const value_type &v) const
void remove(const value_type &v)
std::pair< iterator, bool > insert(value_type &&v)
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
QDynamicMetaObjectData * metaObject
static QMetaObject::Connection connect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
static bool disconnect(const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
QVariant property(const char *name) const
Returns the value of the object's name property.
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
bool isValid() const
Returns {true} if this persistent model index is valid; otherwise returns {false}.
\inmodule QtCore\reentrant
constexpr qreal & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
\inmodule QtCore\reentrant
constexpr int & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr int & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
A base class for pointer events.
GrabTransition
This enum represents a transition of exclusive or passive grab from one object (possibly nullptr) to ...
The QQmlChangeSet class stores an ordered list of notifications about changes to a linear data set.
The QQmlComponent class encapsulates a QML component definition.
static QQmlData * get(QObjectPrivate *priv, bool create)
IncubationMode
Specifies the mode the incubator operates in.
void createdItem(int index, QObject *object)
void modelUpdated(const QQmlChangeSet &changeSet, bool reset)
virtual const QAbstractItemModel * abstractItemModel() const
virtual QQmlIncubator::Status incubationStatus(int index)=0
void initItem(int index, QObject *object)
virtual ReleaseFlags release(QObject *object, ReusableFlag reusableFlag=NotReusable)=0
void drainReusableItemsPool(int maxPoolTime) override
bool canFetchMore() const
bool setRequiredProperty(int index, const QString &name, const QVariant &value) final
void setModel(const QVariant &model)
QQmlComponent * delegate() const
void useImportVersion(QTypeRevision version)
void setDelegate(QQmlComponent *)
void dispose(QObject *object)
ReleaseFlags release(QObject *object, ReusableFlag reusable=NotReusable) override
bool isRunning() const
\qmlproperty bool QtQuick::Animation::running This property holds whether the animation is currently ...
void complete()
\qmlmethod QtQuick::Animation::complete()
void restart()
\qmlmethod QtQuick::Animation::restart()
void stop()
\qmlmethod QtQuick::Animation::stop()
Qt::Orientations activeDirections() const
void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions={ })
virtual void fixup(AxisData &data, qreal minExtent, qreal maxExtent)
void updateBeginningEnd()
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
virtual qreal minYExtent() const
void setContentWidth(qreal)
virtual void viewportMoved(Qt::Orientations orient)
bool isMoving() const
\qmlproperty bool QtQuick::Flickable::moving \qmlproperty bool QtQuick::Flickable::movingHorizontally...
virtual qreal maxXExtent() const
virtual qreal maxYExtent() const
virtual qreal minXExtent() const
void setContentHeight(qreal)
Qt::KeyboardModifiers modifiers
void handleEventPoint(QPointerEvent *ev, QEventPoint &point) override
QQuickAnchors * anchors() const
\qmlpropertygroup QtQuick::Item::anchors \qmlproperty AnchorLine QtQuick::Item::anchors....
QPointer< QQuickItem > subFocusItem
QQuickDeliveryAgentPrivate * deliveryAgentPrivate()
QQmlListProperty< QQuickItem > children()
static QQuickItemPrivate * get(QQuickItem *item)
QPointer< QQuickItem > item
void setVisible(bool visible)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
virtual void keyPressEvent(QKeyEvent *event)
This event handler can be reimplemented in a subclass to receive key press events for an item.
Q_INVOKABLE QPointF mapToItem(const QQuickItem *item, const QPointF &point) const
Maps the given point in this item's coordinate system to the equivalent point within item's coordinat...
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
bool activeFocusOnTab() const
\qmlproperty bool QtQuick::Item::activeFocusOnTab
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
qreal width
This property holds the width of this item.
QQuickItem * parentItem() const
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
qreal height
This property holds the height of this item.
bool enabled
\qmlproperty bool QtQuick::Item::enabled
QQuickItem * parentItem() const
\qmlproperty Item QtQuick::PointerHandler::parent
void setMargin(qreal pointDistanceThreshold)
virtual bool wantsEventPoint(const QPointerEvent *event, const QEventPoint &point)
Returns true if the given point (as part of event) could be relevant at all to this handler,...
void setPassiveGrab(QPointerEvent *event, const QEventPoint &point, bool grab=true)
Acquire or give up a passive grab of the given point, according to the grab state.
void setGrabPermissions(GrabPermissions grabPermissions)
void setEnabled(bool enabled)
@ CanTakeOverFromAnything
bool setExclusiveGrab(QPointerEvent *ev, const QEventPoint &point, bool grab=true)
Acquire or give up the exclusive grab of the given point, according to the grab state,...
void setTo(const QVariant &)
void setEasing(const QEasingCurve &)
void setTargetObject(QObject *)
virtual void setDuration(int)
void setProperty(const QString &)
void onGrabChanged(QQuickPointerHandler *grabber, QPointingDevice::GrabTransition transition, QPointerEvent *event, QEventPoint &point) override
Notification that the grab has changed in some way which is relevant to this handler.
void handleEventPoint(QPointerEvent *event, QEventPoint &point) override
QQuickTableViewHoverHandler(QQuickTableView *view)
bool isHoveringGrid() const
bool containsIndex(Qt::Edge edge, int index)
QPoint currentCell() const
QQmlIncubator::IncubationMode incubationMode() const
void begin(const QPoint &cell, const QPointF &pos, QQmlIncubator::IncubationMode incubationMode)
QPointF startPosition() const
bool hasCurrentCell() const
void updateSelectedOnAllDelegateItems()
bool canUnloadTableEdge(Qt::Edge tableEdge, const QRectF fillRect) const
QQuickTableView::SelectionBehavior selectionBehavior
bool editFromKeyEvent(QKeyEvent *e)
bool canLoadTableEdge(Qt::Edge tableEdge, const QRectF fillRect) const
void calculateTopLeft(QPoint &topLeft, QPointF &topLeftPos)
QQuickItem * selectionPointerHandlerTarget() const override
void drainReusePoolAfterLoadRequest()
QPoint cellAtModelIndex(int modelIndex) const
void releaseLoadedItems(QQmlTableInstanceModel::ReusableFlag reusableFlag)
void layoutVerticalEdge(Qt::Edge tableEdge)
void adjustViewportXAccordingToAlignment()
virtual void itemCreatedCallback(int modelIndex, QObject *object)
void setCurrentOnDelegateItem(const QModelIndex &index, bool isCurrent)
bool setCurrentIndexFromKeyEvent(QKeyEvent *e)
qreal getEffectiveRowHeight(int row) const
void syncLoadedTableFromLoadRequest()
void updateAverageRowHeight()
void rowsMovedCallback(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
void createWrapperModel()
virtual QVariant modelImpl() const
virtual void itemReusedCallback(int modelIndex, QObject *object)
FxTableItem * createFxTableItem(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode)
void disconnectFromModel()
qreal cellHeight(const QPoint &cell) const
void layoutAfterLoadingInitialTable()
qreal cellWidth(const QPoint &cell) const
QQuickTableView::SelectionMode selectionMode
qreal getAlignmentContentX(int column, Qt::Alignment alignment, const qreal offset, const QRectF &subRect)
@ CalculateNewContentHeight
@ CalculateNewTopLeftColumn
@ CalculateNewContentWidth
void modelResetCallback()
void rowsRemovedCallback(const QModelIndex &parent, int begin, int end)
qreal getColumnWidth(int column) const
void scheduleRebuildIfFastFlick()
QSizeF scrollTowardsSelectionPoint(const QPointF &pos, const QSizeF &step) override
qreal getColumnLayoutWidth(int column)
void setSelectionEndPos(const QPointF &pos) override
Qt::Edge nextEdgeToUnload(const QRectF rect)
void forceLayout(bool immediate)
bool pointerNavigationEnabled
QJSValue rowHeightProvider
void releaseItem(FxTableItem *fxTableItem, QQmlTableInstanceModel::ReusableFlag reusableFlag)
void unloadItem(const QPoint &cell)
void selectionChangedInSelectionModel(const QItemSelection &selected, const QItemSelection &deselected)
int assignedPositionViewAtRowAfterRebuild
QRectF positionViewAtRowSubRect
@ MovePreloadedItemsToPool
virtual void syncDelegate()
qreal positionViewAtRowOffset
bool inSetLocalViewportPos
RebuildOptions scheduledRebuildOptions
QQmlNullableValue< qreal > explicitContentWidth
bool atTableEnd(Qt::Edge edge) const
~QQuickTableViewPrivate() override
void setSelectionStartPos(const QPointF &pos) override
QRectF loadedTableOuterRect
QRectF selectionRectangle() const override
QList< QPointer< QQuickTableView > > syncChildren
void scheduleRebuildTable(QQuickTableViewPrivate::RebuildOptions options)
QQuickTableView * rootSyncView() const
void currentChangedInSelectionModel(const QModelIndex ¤t, const QModelIndex &previous)
QQmlGuard< QQmlComponent > assignedDelegate
qreal getAlignmentContentY(int row, Qt::Alignment alignment, const qreal offset, const QRectF &subRect)
FxTableItem * loadedTableItem(const QPoint &cell) const
QQmlInstanceModel * model
QMargins edgesBeforeRebuild
int positionViewAtColumnAfterRebuild
bool selectedInSelectionModel(const QPoint &cell) const
bool scrollToColumn(int column, Qt::Alignment alignment, qreal offset, const QRectF subRect=QRectF())
void layoutTableEdgeFromLoadRequest()
void positionViewAtRow(int row, Qt::Alignment alignment, qreal offset, const QRectF subRect=QRectF())
int nextVisibleEdgeIndex(Qt::Edge edge, int startIndex) const
QQuickTableViewHoverHandler * hoverHandler
virtual void modelUpdated(const QQmlChangeSet &changeSet, bool reset)
EdgeRange cachedNextVisibleEdgeIndex[4]
RebuildOptions rebuildOptions
static QQuickTableViewPrivate * get(QQuickTableView *q)
bool warnNoSelectionModel
void fixup(AxisData &data, qreal minExtent, qreal maxExtent) override
void clearEdgeSizeCache()
QTypeRevision resolveImportVersion()
virtual void syncWithPendingChanges()
qreal getRowHeight(int row) const
void normalizeSelection() override
void updateContentHeight()
QJSValue columnWidthProvider
void layoutHorizontalEdge(Qt::Edge tableEdge)
bool isColumnHidden(int column) const
QRectF positionViewAtColumnSubRect
bool scrollToRow(int row, Qt::Alignment alignment, qreal offset, const QRectF subRect=QRectF())
QString tableLayoutToString() const
void loadEdge(Qt::Edge edge, QQmlIncubator::IncubationMode incubationMode)
bool keyNavigationEnabled
virtual void initItemCallback(int modelIndex, QObject *item)
bool inSyncViewportPosRecursive
bool startSelection(const QPointF &pos) override
EdgeRange cachedColumnWidth
bool cellIsValid(const QPoint &cell) const
qreal sizeHintForRow(int row) const
virtual void updateSelection(const QRect &oldSelection, const QRect &newSelection)
void updateContentWidth()
Qt::Alignment positionViewAtColumnAlignment
virtual void syncSyncView()
bool currentInSelectionModel(const QPoint &cell) const
qreal getEffectiveColumnX(int column) const
void clearSelection() override
QQuickTableView::EditTriggers editTriggers
QPointer< QQuickTableView > assignedSyncView
Qt::Edge nextEdgeToLoad(const QRectF rect)
Qt::Orientations assignedSyncDirection
void processLoadRequest()
Qt::Alignment positionViewAtRowAlignment
QQmlTableInstanceModel * editModel
int edgeToArrayIndex(Qt::Edge edge) const
FxTableItem * loadFxTableItem(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode)
QQmlNullableValue< qreal > explicitContentHeight
void updatePolish() override
void setLocalViewportX(qreal contentX)
TableEdgeLoadRequest loadRequest
RebuildOptions checkForVisibilityChanges()
void setCurrentIndexFromTap(const QPointF &pos)
QQmlTableInstanceModel::ReusableFlag reusableFlag
void layoutChangedCallback(const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
bool isRowHidden(int row) const
void loadAndUnloadVisibleEdges(QQmlIncubator::IncubationMode incubationMode=QQmlIncubator::AsynchronousIfNested)
QRectF loadedTableInnerRect
QQuickPropertyAnimation positionXAnimation
QMinimalFlatSet< int > loadedColumns
QHash< int, FxTableItem * > loadedItems
QAbstractItemModel * qaim(QVariant modelAsVariant) const
void setLocalViewportY(qreal contentY)
void rowsInsertedCallback(const QModelIndex &parent, int begin, int end)
QMinimalFlatSet< int > loadedRows
void relayoutTableItems()
void setCurrentIndex(const QPoint &cell)
QQuickTableViewAttached * getAttachedObject(const QObject *object) const
bool blockItemCreatedCallback
qreal positionViewAtColumnOffset
virtual void setModelImpl(const QVariant &newModel)
void updateCurrentRowAndColumn()
QPoint selectionStartCell
QSize calculateTableSize()
qreal getEffectiveColumnWidth(int column) const
void unloadEdge(Qt::Edge edge)
void cancelOvershootAfterLayout()
void columnsRemovedCallback(const QModelIndex &parent, int begin, int end)
RebuildState rebuildState
qreal sizeHintForColumn(int column) const
void processRebuildTable()
int modelIndexAtCell(const QPoint &cell) const
QPointer< QItemSelectionModel > selectionModel
qreal getRowLayoutHeight(int row)
qreal getEffectiveRowY(int row) const
void shiftLoadedTableRect(const QPointF newPosition)
bool moveToNextRebuildState()
virtual void syncPositionView()
void adjustViewportYAccordingToAlignment()
int assignedPositionViewAtColumnAfterRebuild
int modelIndexToCellIndex(const QModelIndex &modelIndex) const
int nextVisibleEdgeIndexAroundLoadedTable(Qt::Edge edge) const
QPoint clampedCellAtPos(const QPointF &pos) const
QPointer< QQmlTableInstanceModel > tableModel
QPointer< QQuickTableView > syncView
void syncRebuildOptions()
void setRequiredProperty(const char *property, const QVariant &value, int serializedModelIndex, QObject *object, bool init)
void updateAverageColumnWidth()
QQuickPropertyAnimation positionYAnimation
bool canEdit(const QModelIndex tappedIndex, bool warn)
void setSelectedOnDelegateItem(const QModelIndex &modelIndex, bool select)
int positionViewAtRowAfterRebuild
EdgeRange cachedRowHeight
void syncViewportPosRecursive()
void columnsInsertedCallback(const QModelIndex &parent, int begin, int end)
void syncLoadedTableRectFromLoadedTable()
virtual void itemPooledCallback(int modelIndex, QObject *object)
bool updateTableRecursive()
void handleTap(const QQuickHandlerPoint &point)
void positionViewAtColumn(int column, Qt::Alignment alignment, qreal offset, const QRectF subRect=QRectF())
QPersistentModelIndex editIndex
QQuickTableViewResizeHandler * resizeHandler
void columnsMovedCallback(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)
void onGrabChanged(QQuickPointerHandler *grabber, QPointingDevice::GrabTransition transition, QPointerEvent *ev, QEventPoint &point) override
Notification that the grab has changed in some way which is relevant to this handler.
void updateState(QEventPoint &point)
void updateDrag(QPointerEvent *event, QEventPoint &point)
QQuickTableViewResizeHandler(QQuickTableView *view)
void handleEventPoint(QPointerEvent *event, QEventPoint &point) override
bool wantsEventPoint(const QPointerEvent *event, const QEventPoint &point) override
Returns true if the given point (as part of event) could be relevant at all to this handler,...
bool wantsEventPoint(const QPointerEvent *event, const QEventPoint &point) override
Returns true if the given point (as part of event) could be relevant at all to this handler,...
QQuickTableViewTapHandler(QQuickTableView *view)
void setReuseItems(bool reuseItems)
FINALQt::Orientations syncDirection
Q_INVOKABLE void positionViewAtIndex(const QModelIndex &index, PositionMode mode, const QPointF &offset=QPointF(), const QRectF &subRect=QRectF())
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
FINALSelectionBehavior selectionBehavior
void setSyncView(QQuickTableView *view)
FINALbool resizableColumns
Q_INVOKABLE void positionViewAtRow(int row, PositionMode mode, qreal offset=0, const QRectF &subRect=QRectF())
FINALSelectionMode selectionMode
void setSelectionBehavior(SelectionBehavior selectionBehavior)
void setResizableColumns(bool enabled)
QQuickTableView(QQuickItem *parent=nullptr)
void setSelectionModel(QItemSelectionModel *selectionModel)
void setAnimate(bool animate)
void setDelegate(QQmlComponent *)
FINALbool keyNavigationEnabled
void setAlternatingRows(bool alternatingRows)
~QQuickTableView() override
void setSelectionMode(SelectionMode selectionMode)
qreal minYExtent() const override
void setEditTriggers(EditTriggers editTriggers)
void setResizableRows(bool enabled)
FINALQItemSelectionModel * selectionModel
void componentFinalized() override
The customization point provided by this interface.
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void setModel(const QVariant &newModel)
void setKeyNavigationEnabled(bool enabled)
Q_INVOKABLE void positionViewAtColumn(int column, PositionMode mode, qreal offset=0, const QRectF &subRect=QRectF())
QQuickTableView * syncView
void columnWidthProviderChanged()
FINALbool pointerNavigationEnabled
FINALEditTriggers editTriggers
void viewportMoved(Qt::Orientations orientation) override
QJSValue rowHeightProvider
qreal maxYExtent() const override
qreal minXExtent() const override
void setRowHeightProvider(const QJSValue &provider)
void rowHeightProviderChanged()
Q_INVOKABLE void forceLayout()
Q_INVOKABLE QQuickItem * itemAtCell(const QPoint &cell) const
void setColumnWidthProvider(const QJSValue &provider)
Q_INVOKABLE void positionViewAtCell(const QPoint &cell, PositionMode mode, const QPointF &offset=QPointF(), const QRectF &subRect=QRectF())
void setRowSpacing(qreal spacing)
void setSyncDirection(Qt::Orientations direction)
qreal maxXExtent() const override
void setPointerNavigationEnabled(bool enabled)
void setColumnSpacing(qreal spacing)
void setContentHeight(qreal height)
FINALbool alternatingRows
void keyPressEvent(QKeyEvent *e) override
This event handler can be reimplemented in a subclass to receive key press events for an item.
void setContentWidth(qreal width)
void columnSpacingChanged()
QJSValue columnWidthProvider
static QQuickTableViewAttached * qmlAttachedProperties(QObject *)
void doubleTapped(QEventPoint eventPoint, Qt::MouseButton)
void singleTapped(QEventPoint eventPoint, Qt::MouseButton)
bool wantsEventPoint(const QPointerEvent *event, const QEventPoint &point) override
Returns true if the given point (as part of event) could be relevant at all to this handler,...
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
QObject * focusObject() const override
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void moveRight(qreal pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's right edge at the given finite x coordinate...
constexpr void moveTopLeft(const QPointF &p) noexcept
Moves the rectangle, leaving the top-left corner at the given position.
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
bool intersects(const QRectF &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e.
constexpr void setWidth(qreal w) noexcept
Sets the width of the rectangle to the given finite width.
constexpr void moveBottom(qreal pos) noexcept
Moves the rectangle vertically, leaving the rectangle's bottom edge at the given finite y coordinate.
constexpr QPointF topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
constexpr void moveLeft(qreal pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's left edge at the given finite x coordinate.
constexpr QPointF bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void setHeight(qreal h) noexcept
Sets the height of the rectangle to the given finite height.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
constexpr void moveTop(qreal pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top line at the given finite y coordinate.
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
QRect normalized() const noexcept
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal & rwidth() noexcept
Returns a reference to the width.
constexpr void setHeight(qreal h) noexcept
Sets the height to the given finite height.
constexpr qreal & rheight() noexcept
Returns a reference to the height.
constexpr void setWidth(qreal w) noexcept
Sets the width to the given finite width.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
static constexpr QTypeRevision zero()
Produces a QTypeRevision with major and minor version {0}.
qreal toReal(bool *ok=nullptr) const
Returns the variant as a qreal if the variant has userType() \l QMetaType::Double,...
float toFloat(bool *ok=nullptr) const
Returns the variant as a float if the variant has userType() \l QMetaType::Double,...
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QStringList toStringList() const
Returns the variant as a QStringList if the variant has userType() \l QMetaType::QStringList,...
QSet< QString >::iterator it
object setObjectName("A new object name")
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
bool qIsNaN(qfloat16 f) noexcept
qfloat16 qSqrt(qfloat16 f)
QList< QJSValue > QJSValueList
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
static Q_DECL_CONST_FUNCTION bool qt_is_finite(double d)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * row
QQmlContext * qmlContext(const QObject *obj)
QQuickItem * qmlobject_cast< QQuickItem * >(QObject *object)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QQuickAttachedPropertyPropagator * attachedObject(const QMetaObject *type, QObject *object, bool create=false)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
static const Qt::Edge allTableEdges[]
static const char * kRequiredProperties
#define Q_TABLEVIEW_ASSERT(cond, output)
#define Q_TABLEVIEW_UNREACHABLE(output)
\qmltype TableView \inqmlmodule QtQuick
static const char * kRequiredProperty_selected
static const char * kRequiredProperty_editing
static const char * kRequiredProperty_current
static const qreal kDefaultColumnWidth
static const int kEdgeIndexAtEnd
static QT_BEGIN_NAMESPACE const qreal kDefaultRowHeight
static const int kEdgeIndexNotSet
QLatin1StringView QLatin1String
#define QStringLiteral(str)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, bool createJSValueForObjectsAndSymbols, V4ObjectSet *visitedObjects)
std::uniform_real_distribution dist(1, 2.5)
[2]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
myObject disconnect()
[26]
selection select(topLeft, bottomRight)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent