1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QUICKTESTUTIL_P_H
5#define QUICKTESTUTIL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickTest/private/quicktestglobal_p.h>
19
20#include <QtCore/qobject.h>
21#include <QtQml/qqml.h>
22#include <QtQml/private/qqmlsignalnames_p.h>
23#include <QtQml/qjsvalue.h>
24
25QT_BEGIN_NAMESPACE
26
27class Q_QMLTEST_EXPORT QuickTestUtil : public QObject
28{
29 Q_OBJECT
30 Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged)
31 Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged)
32 QML_NAMED_ELEMENT(TestUtil)
33 QML_ADDED_IN_VERSION(1, 0)
34public:
35 QuickTestUtil(QObject *parent = nullptr) :QObject(parent) {}
36 ~QuickTestUtil() override {}
37
38 bool printAvailableFunctions() const;
39 int dragThreshold() const;
40
41 Q_INVOKABLE void populateClipboardText(int lineCount);
42
43Q_SIGNALS:
44 void printAvailableFunctionsChanged();
45 void dragThresholdChanged();
46
47public Q_SLOTS:
48
49 QJSValue typeName(const QVariant& v) const;
50 bool compare(const QVariant& act, const QVariant& exp) const;
51
52 QJSValue callerFile(int frameIndex = 0) const;
53 int callerLine(int frameIndex = 0) const;
54
55 Q_REVISION(6, 7) QString signalHandlerName(const QString &signalName)
56 {
57 if (QQmlSignalNames::isHandlerName(signalName))
58 return signalName;
59 return QQmlSignalNames::signalNameToHandlerName(signal: signalName);
60 }
61};
62
63QT_END_NAMESPACE
64
65#endif // QUICKTESTUTIL_P_H
66

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtdeclarative/src/qmltest/quicktestutil_p.h