Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQuickVisualTestUtils Namespace Reference

Classes

class  MnemonicKeySimulator
 
class  PointLerper
 
class  QQuickApplicationHelper
 
struct  SignalMultiSpy
 

Enumerations

enum class  FindViewDelegateItemFlag { None = 0x0 , PositionViewAtIndex = 0x01 }
 

Functions

QQuickItemfindVisibleChild (QQuickItem *parent, const QString &objectName)
 
void dumpTree (QQuickItem *parent, int depth=0)
 
void moveMouseAway (QQuickWindow *window)
 
void centerOnScreen (QQuickWindow *window)
 
template<typename F >
void forEachStep (int steps, F &&func)
 
QPoint lerpPoints (const QPoint &point1, const QPoint &point2, qreal t)
 
bool delegateVisible (QQuickItem *item)
 
template<typename T >
T * findItem (QQuickItem *parent, const QString &objectName, int index=-1)
 
template<typename T >
QList< T * > findItems (QQuickItem *parent, const QString &objectName, bool visibleOnly=true)
 
template<typename T >
QList< T * > findItems (QQuickItem *parent, const QString &objectName, const QList< int > &indexes)
 
bool compareImages (const QImage &ia, const QImage &ib, QString *errorMessage)
 
template<typename T >
bool findViewDelegateItem (QQuickItemView *itemView, int index, T &delegateItem, FindViewDelegateItemFlags flags=FindViewDelegateItemFlag::PositionViewAtIndex)
 
QPoint mapCenterToWindow (const QQuickItem *item)
 
QPoint mapToWindow (const QQuickItem *item, qreal relativeX, qreal relativeY)
 
QPoint mapToWindow (const QQuickItem *item, const QPointF &relativePos)
 

Enumeration Type Documentation

◆ FindViewDelegateItemFlag

Enumerator
None 
PositionViewAtIndex 

Definition at line 154 of file visualtestutils_p.h.

Function Documentation

◆ centerOnScreen()

void QQuickVisualTestUtils::centerOnScreen ( QQuickWindow window)

Definition at line 58 of file visualtestutils.cpp.

References QRect::center(), and window().

+ Here is the call graph for this function:

◆ compareImages()

bool QQuickVisualTestUtils::compareImages ( const QImage ia,
const QImage ib,
QString errorMessage 
)

Compares ia with ib, returning true if the images are equal. If they are not equal, false is returned and errorMessage is set.

A custom compare function to avoid issues such as: When running on native Nvidia graphics cards on linux, the distance field glyph pixels have a measurable, but not visible pixel error. This was GT-216 with the ubuntu "nvidia-319" driver package. llvmpipe does not show the same issue.

Definition at line 131 of file visualtestutils.cpp.

References QImage::constScanLine(), QImage::devicePixelRatio(), errorMessage(), QImage::format(), QImage::height(), Qt::hex(), qAbs(), qRed(), Qt::showbase(), QImage::size(), and QImage::width().

+ Here is the call graph for this function:

◆ delegateVisible()

bool QQuickVisualTestUtils::delegateVisible ( QQuickItem item)

Definition at line 114 of file visualtestutils.cpp.

References QQuickItemPrivate::culled, QQuickItemPrivate::get(), QGraphicsItem::isVisible(), and item.

+ Here is the call graph for this function:

◆ dumpTree()

void QQuickVisualTestUtils::dumpTree ( QQuickItem parent,
int  depth = 0 
)

Definition at line 31 of file visualtestutils.cpp.

References dumpTree(), i, item, QString::left(), parent, qDebug, qobject_cast< QQuickItem * >(), and QStringLiteral.

Referenced by dumpTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findItem()

template<typename T >
T * QQuickVisualTestUtils::findItem ( QQuickItem parent,
const QString objectName,
int  index = -1 
)

Definition at line 70 of file visualtestutils_p.h.

References context, e, i, QString::isEmpty(), item, mo, parent, qmlContext(), and qobject_cast< QQuickItem * >().

+ Here is the call graph for this function:

◆ findItems() [1/2]

template<typename T >
QList< T * > QQuickVisualTestUtils::findItems ( QQuickItem parent,
const QString objectName,
bool  visibleOnly = true 
)

Definition at line 100 of file visualtestutils_p.h.

References QList< T >::append(), QQuickItemPrivate::culled, QQuickItemPrivate::get(), i, QString::isEmpty(), QGraphicsItem::isVisible(), item, items, mo, parent, and qobject_cast< QQuickItem * >().

+ Here is the call graph for this function:

◆ findItems() [2/2]

template<typename T >
QList< T * > QQuickVisualTestUtils::findItems ( QQuickItem parent,
const QString objectName,
const QList< int > &  indexes 
)

Definition at line 117 of file visualtestutils_p.h.

References i, items, parent, qobject_cast< QQuickItem * >(), and QList< T >::size().

+ Here is the call graph for this function:

◆ findViewDelegateItem()

template<typename T >
bool QQuickVisualTestUtils::findViewDelegateItem ( QQuickItemView itemView,
int  index,
T &  delegateItem,
FindViewDelegateItemFlags  flags = FindViewDelegateItemFlag::PositionViewAtIndex 
)

Same as above except allows use in QTRY_* functions without having to call it again afterwards to assign the delegate.

Definition at line 172 of file visualtestutils_p.h.

References findViewDelegateItem().

Referenced by findViewDelegateItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findVisibleChild()

QT_BEGIN_NAMESPACE QQuickItem * QQuickVisualTestUtils::findVisibleChild ( QQuickItem parent,
const QString objectName 
)

Definition at line 18 of file visualtestutils.cpp.

References QList< T >::at(), QQuickItemPrivate::culled, QQuickItemPrivate::get(), i, item, items, parent, and QList< T >::size().

+ Here is the call graph for this function:

◆ forEachStep()

template<typename F >
void QQuickVisualTestUtils::forEachStep ( int  steps,
F &&  func 
)

Definition at line 38 of file visualtestutils_p.h.

References i.

Referenced by QQuickVisualTestUtils::PointLerper::move().

+ Here is the caller graph for this function:

◆ lerpPoints()

QPoint QQuickVisualTestUtils::lerpPoints ( const QPoint point1,
const QPoint point2,
qreal  t 
)

Definition at line 65 of file visualtestutils.cpp.

References _q_interpolate(), QPoint::x(), and QPoint::y().

Referenced by QQuickVisualTestUtils::PointLerper::move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mapCenterToWindow()

QPoint QQuickVisualTestUtils::mapCenterToWindow ( const QQuickItem item)

Definition at line 256 of file visualtestutils.cpp.

References item, QGraphicsItem::mapToScene(), and QPointF::toPoint().

+ Here is the call graph for this function:

◆ mapToWindow() [1/2]

QPoint QQuickVisualTestUtils::mapToWindow ( const QQuickItem item,
const QPointF relativePos 
)

Definition at line 266 of file visualtestutils.cpp.

References item, mapToWindow(), QPointF::x(), and QPointF::y().

+ Here is the call graph for this function:

◆ mapToWindow() [2/2]

QPoint QQuickVisualTestUtils::mapToWindow ( const QQuickItem item,
qreal  relativeX,
qreal  relativeY 
)

Definition at line 261 of file visualtestutils.cpp.

References item, QGraphicsItem::mapToScene(), and QPointF::toPoint().

Referenced by mapToWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveMouseAway()

void QQuickVisualTestUtils::moveMouseAway ( QQuickWindow window)

Definition at line 43 of file visualtestutils.cpp.

References leave, QEvent::Leave, QCoreApplication::sendEvent(), QCursor::setPos(), and window().

+ Here is the call graph for this function: