6#include <QtCore/QRandomGenerator>
7#include <QtCore/QTimer>
8#include <QtQuick/QQuickView>
9#include <QtQuick/QQuickView>
10#include <QtGui/QScreen>
11#include <QtGui/qpa/qwindowsysteminterface.h>
13#include <QtTest/QTest>
15#include <QtQuick/private/qquickdeliveryagent_p_p.h>
16#if QT_CONFIG(quick_itemview)
17#include <QtQuick/private/qquickitemview_p_p.h>
19#include <QtQuick/private/qquickwindow_p.h>
21#include <QtQuickTestUtils/private/visualtestutils_p.h>
36 const QRect screenGeometry =
window->screen()->availableGeometry();
69 const int pointCount = 5;
75 for (
int i = 0;
i < pointCount; ++
i)
85 for (
int i=0;
i<indexes.
size();
i++) {
98 for (
int i=0;
i<indexes.
size();
i++) {
105 }
else if (from > to) {
119 for (
int i=0;
i<indexes.
size();
i++) {
120 int num = indexes[
i];
149 roles.
insert(Number,
"number");
158 else if (role == Number)
166 return rowCount() * columnCount();
183 emit endInsertRows();
191 emit endInsertRows();
198 emit endInsertRows();
206 emit endInsertRows();
213 emit endRemoveRows();
221 emit endRemoveRows();
256 emit beginResetModel();
257 emit endResetModel();
275 operator const char*()
const {
return data; }
282 for (
int i=0;
i<
other.size();
i++) {
321 a.indexes.append(
other.indexes);
327 return QSet<int>(indexes.cbegin(), indexes.cend())
333 return !(*
this ==
other);
343 return indexes.size();
351 for (
int i=0;
i<indexes.size();
i++)
379 if (m_rowCount > 10) {
380 for (
int i = 0;
i < 10; ++
i) {
387 if (m_rowCount < 20) {
388 for (
int i = 0;
i < 10; ++
i) {
397#if QT_CONFIG(quick_itemview)
403 for (
int i = 0;
i <
priv->visibleItems.size(); ++
i) {
415 if (
item->index == -1) {
417 }
else if (
item->index !=
priv->visibleIndex +
i - skip) {
420 *expectedIdx =
priv->visibleIndex +
i - skip;
481 const QRect screenGeometry =
view.screen()->availableGeometry();
489 #if QT_CONFIG(cursor)
529 switch (dev->
type()) {
548 qWarning() <<
"can't send a press event from" << dev;
555 switch (dev->
type()) {
572 qWarning() <<
"can't send a move event from" << dev;
580 switch (dev->
type()) {
597 qWarning() <<
"can't send a press event from" << dev;
606#include "moc_viewtestutils_p.cpp"
virtual QHash< int, QByteArray > roleNames() const
static void setPos(int x, int y)
Moves the cursor (hot spot) of the primary screen to the global screen position (x,...
T & value() const noexcept
Returns a modifiable reference to the current item's value.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
qsizetype size() const noexcept
void removeAt(qsizetype i)
iterator insert(qsizetype i, parameter_type t)
const_reference at(qsizetype i) const noexcept
void move(qsizetype from, qsizetype to)
void append(parameter_type t)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\inmodule QtCore\reentrant
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
The QQmlError class encapsulates a QML error.
std::unique_ptr< QMutableTouchEvent > delayedTouch
void deliverDelayedTouchEvent()
static QQuickItemPrivate * get(QQuickItem *item)
bool operator==(const ListRange &other) const
QList< QPair< QString, QString > > getModelDataValues(const QaimModel &model)
bool operator!=(const ListRange &other) const
ListRange operator+(const ListRange &other) const
void insertItem(int index, const QString &name, const QString &number)
Q_INVOKABLE void addItem(const QString &name, const QString &number)
QString number(int index) const
QHash< int, QByteArray > roleNames() const override
Q_INVOKABLE void removeItem(int index)
QaimModel(QObject *parent=0)
void removeItems(int index, int count)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void matchAgainst(const QList< QPair< QString, QString > > &other, const QString &error1, const QString &error2)
void insertItems(int index, const QList< QPair< QString, QString > > &items)
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
void resetItems(const QList< QPair< QString, QString > > &items)
QString name(int index) const
void modifyItem(int idx, const QString &name, const QString &number)
void addItems(const QList< QPair< QString, QString > > &items)
void moveItems(int from, int to, int count)
void moveItem(int from, int to)
QVariant data(const QModelIndex &, int) const override
Returns the data stored under the given role for the item referred to by the index.
int rowCount(const QModelIndex &) const override
Returns the number of rows under the given parent.
The QQuickView class provides a window for displaying a Qt Quick user interface.
QList< QQmlError > errors() const
Return the list of errors that occurred during the last compile or create operation.
Status status
The component's current \l{QQuickView::Status} {status}.
void setSource(const QUrl &)
Sets the source to the url, loads the QML component and instantiates it.
QQuickItem * rootObject() const
Returns the view's root \l {QQuickItem} {item}.
static QQuickWindowPrivate * get(QQuickWindow *c)
QQuickDeliveryAgentPrivate * deliveryAgentPrivate() const
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
double bounded(double highest)
Generates one random double in the range between 0 (inclusive) and highest (exclusive).
\inmodule QtCore\reentrant
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & append(QChar c)
QTouchEventSequence & move(int touchId, const QPoint &pt, QWindow *window=nullptr)
QTouchEventSequence & press(int touchId, const QPoint &pt, QWindow *window=nullptr)
QTouchEventSequence & release(int touchId, const QPoint &pt, QWindow *window=nullptr)
void timeout(QPrivateSignal)
This signal is emitted when the timer times out.
static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, const QPointF &local, const QPointF &global, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
int width
the width of the window's geometry
void show()
Shows the window.
int height
the height of the window's geometry
ScopedPrintable(const QString &string)
EGLImageKHR int int EGLuint64KHR * modifiers
std::list< QString >::iterator Name
void pointerRelease(const QPointingDevice *dev, QQuickWindow *window, int pointId, const QPoint &p, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
static Qt::KeyboardModifiers pressedTabletModifiers
static Qt::MouseButton pressedTabletButton
bool initView(QQuickView &view, const QUrl &url, bool moveMouseOut, QByteArray *errorMessage)
bool showView(QQuickView &view, const QUrl &url)
void pointerMove(const QPointingDevice *dev, QQuickWindow *window, int pointId, const QPoint &p)
void pointerPress(const QPointingDevice *dev, QQuickWindow *window, int pointId, const QPoint &p, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
void flush(QQuickWindow *window)
QQuickView * createView()
QList< int > adjustIndexesForAddDisplaced(const QList< int > &indexes, int index, int count)
QList< int > adjustIndexesForMove(const QList< int > &indexes, int from, int to, int count)
static void qquickmodelviewstestutil_move(int from, int to, int n, T *items)
QList< int > adjustIndexesForRemoveDisplaced(const QList< int > &indexes, int index, int count)
void flick(QQuickView *window, const QPoint &from, const QPoint &to, int duration)
void moveAndPress(QQuickView *window, const QPoint &position)
void centerOnScreen(QQuickView *window, const QSize &size)
void moveMouseAway(QQuickView *window)
void moveAndRelease(QQuickView *window, const QPoint &position)
Combined button and popup list for selecting options.
Q_TESTLIB_EXPORT int lastMouseTimestamp
int Q_TESTLIB_EXPORT defaultMouseDelay()
Q_GUI_EXPORT bool qWaitForWindowExposed(QWindow *window, int timeout=5000)
void mouseMove(QWindow *window, QPoint pos=QPoint(), int delay=-1)
void mouseRelease(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1)
void mousePress(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey=Qt::KeyboardModifiers(), QPoint pos=QPoint(), int delay=-1)
Q_CORE_EXPORT void qWait(int ms)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QTouchEventSequence touchEvent(QWindow *window, QPointingDevice *device, bool autoCommit=true)
std::pair< T1, T2 > QPair
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLsizei const GLchar *const * string
[0]
constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define QVERIFY2(statement, description)
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
QSqlQueryModel * model
[16]
QUrl url("example.com")
[constructor-url-reference]
beginInsertRows(parent, 2, 4)
[0]
beginMoveRows(sourceParent, 2, 4, destinationParent, 2)
[5]
beginRemoveRows(parent, 2, 3)
[1]
char * toString(const MyType &t)
[31]
\inmodule QtCore \reentrant
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent