4#ifndef QQUICKTABLEVIEW_P_P_H
5#define QQUICKTABLEVIEW_P_P_H
20#include <QtCore/qtimer.h>
21#include <QtCore/qitemselectionmodel.h>
22#include <QtQmlModels/private/qqmltableinstancemodel_p.h>
23#include <QtQml/private/qqmlincubator_p.h>
24#include <QtQmlModels/private/qqmlchangeset_p.h>
25#include <QtQml/qqmlinfo.h>
27#include <QtQuick/private/qminimalflatset_p.h>
28#include <QtQuick/private/qquickflickable_p_p.h>
29#include <QtQuick/private/qquickitemviewfxitem_p_p.h>
30#include <QtQuick/private/qquickanimation_p.h>
31#include <QtQuick/private/qquickselectable_p.h>
32#include <QtQuick/private/qquicksinglepointhandler_p.h>
33#include <QtQuick/private/qquickhoverhandler_p.h>
34#include <QtQuick/private/qquicktaphandler_p.h>
46class QQuickTableSectionSizeProviderPrivate;
59 inline bool isHoveringGrid()
const {
return m_row != -1 || m_column != -1; };
147 m_mode = incubationMode;
148 m_edgeIndex = cell.
x();
149 m_visibleCellsInEdge.clear();
150 m_visibleCellsInEdge.append(cell.
y());
153 qCDebug(lcTableViewDelegateLifecycle()) <<
"begin top-left:" <<
toString();
161 m_edgeIndex = edgeIndex;
162 m_visibleCellsInEdge = visibleCellsInEdge;
163 m_mode = incubationMode;
172 inline bool hasCurrentCell()
const {
return m_currentIndex < m_visibleCellsInEdge.size(); }
176 inline int row()
const {
return cellAt(0).y(); }
177 inline int column()
const {
return cellAt(0).x(); }
186 dbg.nospace() <<
"TableSectionLoadRequest(" <<
"edge:"
187 << m_edge <<
", edgeIndex:" << m_edgeIndex <<
", incubation:";
191 dbg <<
"Asynchronous";
194 dbg <<
"AsynchronousIfNested";
197 dbg <<
"Synchronous";
206 QVector<int> m_visibleCellsInEdge;
208 int m_currentIndex = 0;
216 :
QPoint(m_visibleCellsInEdge[
index], m_edgeIndex);
239 MovePreloadedItemsToPool,
248 CalculateNewTopLeftRow = 0x8,
249 CalculateNewTopLeftColumn = 0x10,
250 CalculateNewContentWidth = 0x20,
251 CalculateNewContentHeight = 0x40,
252 PositionViewAtRow = 0x80,
253 PositionViewAtColumn = 0x100,
263 void updatePolish()
override;
264 void fixup(AxisData &
data,
qreal minExtent,
qreal maxExtent)
override;
274 QPointer<QQmlTableInstanceModel> tableModel =
nullptr;
301 RebuildOptions rebuildOptions = RebuildOption::All;
302 RebuildOptions scheduledRebuildOptions = RebuildOption::All;
310 bool blockItemCreatedCallback =
false;
311 mutable bool layoutWarningIssued =
false;
312 bool polishing =
false;
313 bool syncVertically =
false;
314 bool syncHorizontally =
false;
315 bool inSetLocalViewportPos =
false;
316 bool inSyncViewportPosRecursive =
false;
317 bool inUpdateContentSize =
false;
319 bool keyNavigationEnabled =
true;
320 bool pointerNavigationEnabled =
true;
321 bool alternatingRows =
true;
322 bool resizableColumns =
false;
323 bool resizableRows =
false;
325 bool m_cursorSet =
false;
330 bool isTransposed =
false;
332 bool warnNoSelectionModel =
true;
365 bool inSelectionModelUpdate =
false;
367 int assignedPositionViewAtRowAfterRebuild = 0;
368 int assignedPositionViewAtColumnAfterRebuild = 0;
369 int positionViewAtRowAfterRebuild = 0;
370 int positionViewAtColumnAfterRebuild = 0;
372 qreal positionViewAtColumnOffset = 0;
389 int currentColumn = -1;
411 int modelIndexAtCell(
const QPoint &cell)
const;
412 QPoint cellAtModelIndex(
int modelIndex)
const;
413 int modelIndexToCellIndex(
const QModelIndex &modelIndex)
const;
417 qreal sizeHintForRow(
int row)
const;
418 QSize calculateTableSize();
421 inline bool isColumnHidden(
int column)
const;
422 inline bool isRowHidden(
int row)
const;
428 qreal getEffectiveRowY(
int row)
const;
429 qreal getEffectiveRowHeight(
int row)
const;
435 int topRow()
const {
return *loadedRows.cbegin(); }
442 bool updateTableRecursive();
444 void relayoutTableItems();
446 void layoutVerticalEdge(
Qt::Edge tableEdge);
447 void layoutHorizontalEdge(
Qt::Edge tableEdge);
448 void layoutTopLeftItem();
449 void layoutTableEdgeFromLoadRequest();
451 void updateContentWidth();
452 void updateContentHeight();
453 void updateAverageColumnWidth();
454 void updateAverageRowHeight();
455 RebuildOptions checkForVisibilityChanges();
456 void forceLayout(
bool immediate);
458 void updateExtents();
459 void syncLoadedTableRectFromLoadedTable();
460 void syncLoadedTableFromLoadRequest();
461 void shiftLoadedTableRect(
const QPointF newPosition);
463 int nextVisibleEdgeIndex(
Qt::Edge edge,
int startIndex)
const;
464 int nextVisibleEdgeIndexAroundLoadedTable(
Qt::Edge edge)
const;
467 inline int edgeToArrayIndex(
Qt::Edge edge)
const;
468 void clearEdgeSizeCache();
470 bool canLoadTableEdge(
Qt::Edge tableEdge,
const QRectF fillRect)
const;
471 bool canUnloadTableEdge(
Qt::Edge tableEdge,
const QRectF fillRect)
const;
485 void unloadItem(
const QPoint &cell);
489 void drainReusePoolAfterLoadRequest();
490 void processLoadRequest();
492 void processRebuildTable();
493 bool moveToNextRebuildState();
495 void loadInitialTable();
497 void layoutAfterLoadingInitialTable();
498 void adjustViewportXAccordingToAlignment();
499 void adjustViewportYAccordingToAlignment();
500 void cancelOvershootAfterLayout();
502 void scheduleRebuildTable(QQuickTableViewPrivate::RebuildOptions options);
507 void updateEditItem();
508 void updateContentSize();
511 void createWrapperModel();
514 virtual void initItemCallback(
int modelIndex,
QObject *
item);
515 virtual void itemCreatedCallback(
int modelIndex,
QObject *
object);
516 virtual void itemPooledCallback(
int modelIndex,
QObject *
object);
517 virtual void itemReusedCallback(
int modelIndex,
QObject *
object);
520 virtual void syncWithPendingChanges();
521 virtual void syncDelegate();
523 virtual void setModelImpl(
const QVariant &newModel);
524 virtual void syncModel();
525 virtual void syncSyncView();
526 virtual void syncPositionView();
528 inline void syncRebuildOptions();
530 void connectToModel();
531 void disconnectFromModel();
540 void modelResetCallback();
548 void scheduleRebuildIfFastFlick();
549 void setLocalViewportX(
qreal contentX);
550 void setLocalViewportY(
qreal contentY);
551 void syncViewportRect();
552 void syncViewportPosRecursive();
554 bool selectedInSelectionModel(
const QPoint &cell)
const;
556 void updateSelectedOnAllDelegateItems();
559 bool currentInSelectionModel(
const QPoint &cell)
const;
562 void updateCurrentRowAndColumn();
564 void fetchMoreData();
569 inline QString tableLayoutToString()
const;
570 void dumpTable()
const;
572 void setRequiredProperty(
const char *
property,
574 int serializedModelIndex,
578 void setCurrentIndexFromTap(
const QPointF &
pos);
579 void setCurrentIndex(
const QPoint &cell);
580 bool setCurrentIndexFromKeyEvent(
QKeyEvent *e);
581 bool canEdit(
const QModelIndex tappedIndex,
bool warn);
585 QQuickItem *selectionPointerHandlerTarget()
const override;
587 void setSelectionStartPos(
const QPointF &
pos)
override;
588 void setSelectionEndPos(
const QPointF &
pos)
override;
589 void clearSelection()
override;
590 void normalizeSelection()
override;
591 QRectF selectionRectangle()
const override;
594 void cancelSelectionTracking();
597 virtual void updateSelection(
const QRect &oldSelection,
const QRect &newSelection);
qreal sectionSize() const override
qreal endPosition() const override
qreal size() const override
qreal position() const override
FxTableItem(QQuickItem *item, QQuickTableView *table, bool own)
bool contains(qreal, qreal) const override
LayoutChangeHint
This enum describes the way the model changes layout.
The QEventPoint class provides information about a point in a QPointerEvent.
SelectionFlag
This enum describes the way the selection model will be updated.
The QJSValue class acts as a container for Qt/JavaScript data types.
The QKeyEvent class describes a key event.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
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.
IncubationMode
Specifies the mode the incubator operates in.
QPointer< QQuickItem > item
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
bool isHoveringGrid() const
QPoint currentCell() const
void begin(Qt::Edge edgeToLoad, int edgeIndex, const QVector< int > visibleCellsInEdge, QQmlIncubator::IncubationMode incubationMode)
QQmlIncubator::IncubationMode incubationMode() const
void begin(const QPoint &cell, const QPointF &pos, QQmlIncubator::IncubationMode incubationMode)
QPointF startPosition() const
bool hasCurrentCell() const
bool atTableEnd(Qt::Edge edge, int startIndex) const
std::function< void(CallBackFlag)> selectableCallbackFunction
QJSValue rowHeightProvider
QRectF positionViewAtRowSubRect
QQmlNullableValue< qreal > explicitContentWidth
bool atTableEnd(Qt::Edge edge) const
QRectF loadedTableOuterRect
void registerCallbackWhenBindingsAreEvaluated()
QList< QPointer< QQuickTableView > > syncChildren
QQmlGuard< QQmlComponent > assignedDelegate
QMargins edgesBeforeRebuild
static QQuickTableViewPrivate * get(QQuickTableView *q)
QJSValue columnWidthProvider
QRectF positionViewAtColumnSubRect
EdgeRange cachedColumnWidth
bool cellIsValid(const QPoint &cell) const
QSize tableSizeBeforeRebuild
QPointer< QQuickTableView > assignedSyncView
QQmlNullableValue< qreal > explicitContentHeight
TableEdgeLoadRequest loadRequest
QRectF loadedTableInnerRect
QQuickPropertyAnimation positionXAnimation
QMinimalFlatSet< int > loadedColumns
QHash< int, FxTableItem * > loadedItems
QMinimalFlatSet< int > loadedRows
QItemSelection existingSelection
QPointer< QItemSelectionModel > selectionModel
QHash< int, qreal > explicitColumnWidths
QHash< int, qreal > explicitRowHeights
QPointer< QQuickTableView > syncView
QQuickPropertyAnimation positionYAnimation
void _q_componentFinalized()
EdgeRange cachedRowHeight
QPersistentModelIndex editIndex
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)
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
EGLImageKHR int int EGLuint64KHR * modifiers
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char * destination
static QDBusError::ErrorType get(const char *name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLenum GLenum GLsizei void GLsizei void * column
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void * table
static const qreal kDefaultColumnWidth
static const int kEdgeIndexAtEnd
static QT_BEGIN_NAMESPACE const qreal kDefaultRowHeight
static const int kEdgeIndexNotSet
QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIterator begin(const QRegularExpressionMatchIterator &iterator)
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)
QSqlQueryModel * model
[16]
QItemSelection * selection
[0]
selection select(topLeft, bottomRight)
char * toString(const MyType &t)
[31]