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/qquickflickable_p_p.h>
28#include <QtQuick/private/qquickitemviewfxitem_p_p.h>
29#include <QtQuick/private/qquickanimation_p.h>
30#include <QtQuick/private/qquickselectable_p.h>
31#include <QtQuick/private/qquicksinglepointhandler_p.h>
32#include <QtQuick/private/qquickhoverhandler_p.h>
33#include <QtQuick/private/qquicktaphandler_p.h>
35#include <QtCore/private/qminimalflatset_p.h>
47class QQuickTableSectionSizeProviderPrivate;
60 inline bool isHoveringGrid()
const {
return m_row != -1 || m_column != -1; };
148 m_mode = incubationMode;
149 m_edgeIndex = cell.
x();
150 m_visibleCellsInEdge.clear();
151 m_visibleCellsInEdge.append(cell.
y());
154 qCDebug(lcTableViewDelegateLifecycle()) <<
"begin top-left:" <<
toString();
162 m_edgeIndex = edgeIndex;
163 m_visibleCellsInEdge = visibleCellsInEdge;
164 m_mode = incubationMode;
173 inline bool hasCurrentCell()
const {
return m_currentIndex < m_visibleCellsInEdge.size(); }
177 inline int row()
const {
return cellAt(0).y(); }
178 inline int column()
const {
return cellAt(0).x(); }
187 dbg.nospace() <<
"TableSectionLoadRequest(" <<
"edge:"
188 << m_edge <<
", edgeIndex:" << m_edgeIndex <<
", incubation:";
192 dbg <<
"Asynchronous";
195 dbg <<
"AsynchronousIfNested";
198 dbg <<
"Synchronous";
207 QVector<int> m_visibleCellsInEdge;
209 int m_currentIndex = 0;
217 :
QPoint(m_visibleCellsInEdge[
index], m_edgeIndex);
240 MovePreloadedItemsToPool,
249 CalculateNewTopLeftRow = 0x8,
250 CalculateNewTopLeftColumn = 0x10,
251 CalculateNewContentWidth = 0x20,
252 CalculateNewContentHeight = 0x40,
253 PositionViewAtRow = 0x80,
254 PositionViewAtColumn = 0x100,
264 void updatePolish()
override;
265 void fixup(AxisData &
data,
qreal minExtent,
qreal maxExtent)
override;
275 QPointer<QQmlTableInstanceModel> tableModel =
nullptr;
302 RebuildOptions rebuildOptions = RebuildOption::All;
303 RebuildOptions scheduledRebuildOptions = RebuildOption::All;
311 bool blockItemCreatedCallback =
false;
312 mutable bool layoutWarningIssued =
false;
313 bool polishing =
false;
314 bool syncVertically =
false;
315 bool syncHorizontally =
false;
316 bool inSetLocalViewportPos =
false;
317 bool inSyncViewportPosRecursive =
false;
318 bool inUpdateContentSize =
false;
320 bool keyNavigationEnabled =
true;
321 bool pointerNavigationEnabled =
true;
322 bool alternatingRows =
true;
323 bool resizableColumns =
false;
324 bool resizableRows =
false;
326 bool m_cursorSet =
false;
331 bool isTransposed =
false;
333 bool warnNoSelectionModel =
true;
366 bool inSelectionModelUpdate =
false;
368 int assignedPositionViewAtRowAfterRebuild = 0;
369 int assignedPositionViewAtColumnAfterRebuild = 0;
370 int positionViewAtRowAfterRebuild = 0;
371 int positionViewAtColumnAfterRebuild = 0;
373 qreal positionViewAtColumnOffset = 0;
390 int currentColumn = -1;
412 int modelIndexAtCell(
const QPoint &cell)
const;
413 QPoint cellAtModelIndex(
int modelIndex)
const;
414 int modelIndexToCellIndex(
const QModelIndex &modelIndex)
const;
418 qreal sizeHintForRow(
int row)
const;
419 QSize calculateTableSize();
422 inline bool isColumnHidden(
int column)
const;
423 inline bool isRowHidden(
int row)
const;
429 qreal getEffectiveRowY(
int row)
const;
430 qreal getEffectiveRowHeight(
int row)
const;
436 int topRow()
const {
return *loadedRows.cbegin(); }
443 bool updateTableRecursive();
445 void relayoutTableItems();
447 void layoutVerticalEdge(
Qt::Edge tableEdge);
448 void layoutHorizontalEdge(
Qt::Edge tableEdge);
449 void layoutTopLeftItem();
450 void layoutTableEdgeFromLoadRequest();
452 void updateContentWidth();
453 void updateContentHeight();
454 void updateAverageColumnWidth();
455 void updateAverageRowHeight();
456 RebuildOptions checkForVisibilityChanges();
457 void forceLayout(
bool immediate);
459 void updateExtents();
460 void syncLoadedTableRectFromLoadedTable();
461 void syncLoadedTableFromLoadRequest();
462 void shiftLoadedTableRect(
const QPointF newPosition);
464 int nextVisibleEdgeIndex(
Qt::Edge edge,
int startIndex)
const;
465 int nextVisibleEdgeIndexAroundLoadedTable(
Qt::Edge edge)
const;
468 inline int edgeToArrayIndex(
Qt::Edge edge)
const;
469 void clearEdgeSizeCache();
471 bool canLoadTableEdge(
Qt::Edge tableEdge,
const QRectF fillRect)
const;
472 bool canUnloadTableEdge(
Qt::Edge tableEdge,
const QRectF fillRect)
const;
486 void unloadItem(
const QPoint &cell);
490 void drainReusePoolAfterLoadRequest();
491 void processLoadRequest();
493 void processRebuildTable();
494 bool moveToNextRebuildState();
496 void loadInitialTable();
498 void layoutAfterLoadingInitialTable();
499 void adjustViewportXAccordingToAlignment();
500 void adjustViewportYAccordingToAlignment();
501 void cancelOvershootAfterLayout();
503 void scheduleRebuildTable(QQuickTableViewPrivate::RebuildOptions options);
508 void updateEditItem();
509 void updateContentSize();
512 void createWrapperModel();
515 virtual void initItemCallback(
int modelIndex,
QObject *
item);
516 virtual void itemCreatedCallback(
int modelIndex,
QObject *
object);
517 virtual void itemPooledCallback(
int modelIndex,
QObject *
object);
518 virtual void itemReusedCallback(
int modelIndex,
QObject *
object);
521 virtual void syncWithPendingChanges();
522 virtual void syncDelegate();
524 virtual void setModelImpl(
const QVariant &newModel);
525 virtual void syncModel();
526 virtual void syncSyncView();
527 virtual void syncPositionView();
529 inline void syncRebuildOptions();
531 void connectToModel();
532 void disconnectFromModel();
541 void modelResetCallback();
549 void scheduleRebuildIfFastFlick();
550 void setLocalViewportX(
qreal contentX);
551 void setLocalViewportY(
qreal contentY);
552 void syncViewportRect();
553 void syncViewportPosRecursive();
555 bool selectedInSelectionModel(
const QPoint &cell)
const;
557 void updateSelectedOnAllDelegateItems();
560 bool currentInSelectionModel(
const QPoint &cell)
const;
563 void updateCurrentRowAndColumn();
565 void fetchMoreData();
570 inline QString tableLayoutToString()
const;
571 void dumpTable()
const;
573 void setRequiredProperty(
const char *
property,
575 int serializedModelIndex,
579 void setCurrentIndexFromTap(
const QPointF &
pos);
580 void setCurrentIndex(
const QPoint &cell);
581 bool setCurrentIndexFromKeyEvent(
QKeyEvent *e);
582 bool canEdit(
const QModelIndex tappedIndex,
bool warn);
586 QQuickItem *selectionPointerHandlerTarget()
const override;
588 void setSelectionStartPos(
const QPointF &
pos)
override;
589 void setSelectionEndPos(
const QPointF &
pos)
override;
590 void clearSelection()
override;
591 void normalizeSelection()
override;
592 QRectF selectionRectangle()
const override;
595 void cancelSelectionTracking();
598 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]