7#include <QtCore/QObject>
8#include <QtCore/QPoint>
10#include <QtCore/QSize>
12#include <QtCore/QVariant>
66 QVariant
next()
const {
return QVariant::fromValue(
Chain{ }); }
73 Q_PROPERTY(QString text MEMBER
m_text)
76 Q_PROPERTY(
int number MEMBER
m_number)
77 Q_PROPERTY(
double real MEMBER
m_real)
78 Q_PROPERTY(QPoint point MEMBER
m_point)
79 Q_PROPERTY(QPointF pointF MEMBER
m_pointF)
80 Q_PROPERTY(QSize size MEMBER
m_size)
81 Q_PROPERTY(QSizeF sizeF MEMBER
m_sizeF)
82 Q_PROPERTY(QRect rect MEMBER
m_rect)
83 Q_PROPERTY(QRectF rectF MEMBER
m_rectF)
84 Q_PROPERTY(QUrl url MEMBER
m_url)
85 Q_PROPERTY(QByteArray bytes MEMBER
m_bytes)
88 Q_PROPERTY(QObject *buddy MEMBER
m_buddy)
90 Q_PROPERTY(QVariant anything MEMBER
m_anything)
91 Q_PROPERTY(QStringList list MEMBER
m_list)
97 enum Mode { Idle, Busy, Broken };
101 enum
Option { None = 0, Fast = 1, Safe = 2 };
102 Q_DECLARE_FLAGS(Options,
Option)
106 explicit
TestObject(QObject *parent =
nullptr, const QString &name = { }) : QObject(parent)
124 Q_INVOKABLE
int add(
int a,
int b) {
return a + b; }
126 Q_INVOKABLE QString
describe(
const QString &s) {
return QStringLiteral(
"string:") + s; }
130 Q_INVOKABLE QPoint
origin()
const {
return { 1, 2 }; }
139 return { QVariantMap{
140 { QStringLiteral(
"name"), QStringLiteral(
"a") },
141 { QStringLiteral(
"at"), QVariant::fromValue(
Coordinate{ 64, -22 }) } } };
158 void pinged(
int count,
const QString ¬e);
192Q_DECLARE_OPERATORS_FOR_FLAGS(SondeTest::TestObject::Options)
TestObject * m_peer
Backing field.
Definition testobject.h:184
Option
Flag enumeration exposed to the meta-object system.
Definition testobject.h:101
void setMode(SondeTest::TestObject::Mode mode)
Slot taking an enum.
Definition testobject.h:152
void takeOpaque(SondeTest::Opaque)
Invokable with an argument that JSON cannot express.
Definition testobject.h:128
QRectF m_rectF
Backing field.
Definition testobject.h:178
QSize m_size
Backing field.
Definition testobject.h:175
QPoint m_point
Backing field.
Definition testobject.h:173
QStringList m_list
Backing field.
Definition testobject.h:186
QPoint origin() const
Invokable that returns a point.
Definition testobject.h:130
QVariant m_anything
Backing field.
Definition testobject.h:185
double sum(const SondeTest::Coordinate &c) const
Invokable taking a gadget: the sum of its latitude and longitude.
Definition testobject.h:132
void poke()
Slot with no arguments that counts calls.
Definition testobject.h:146
int m_number
Backing field.
Definition testobject.h:171
QByteArray m_bytes
Backing field.
Definition testobject.h:180
TestObject(QObject *parent=nullptr, const QString &name={ })
Creates the object with an optional parent and objectName.
Definition testobject.h:106
void sentOpaque(SondeTest::Opaque value)
Emitted by tests, with an argument JSON can't express.
bool m_visible
Backing field.
Definition testobject.h:169
double m_real
Backing field.
Definition testobject.h:172
QObject * m_buddy
Backing field.
Definition testobject.h:183
int add(int a, int b)
Invokable that adds two numbers.
Definition testobject.h:124
QUrl m_url
Backing field.
Definition testobject.h:179
QString describe(const QString &s)
Invokable overloaded on argument type.
Definition testobject.h:126
void setOptions(Options o)
Setter for the flags property.
Definition testobject.h:114
bool m_enabled
Backing field.
Definition testobject.h:170
void pinged()
Overload of pinged() without arguments.
void setRejecting(int)
Setter that ignores its argument.
Definition testobject.h:121
void pinged(int count, const QString ¬e)
Emitted by tests, with two arguments.
int rejecting() const
Getter of a property whose setter is a no-op.
Definition testobject.h:119
QString m_text
Backing field.
Definition testobject.h:168
QVariantList places() const
Invokable returning a list of maps that hold gadgets, as the viewer's model data does.
Definition testobject.h:137
Mode m_mode
Backing field.
Definition testobject.h:181
QRect m_rect
Backing field.
Definition testobject.h:177
Options m_options
Backing field.
Definition testobject.h:182
Mode
Enumeration exposed to the meta-object system.
Definition testobject.h:97
int pokes
Number of poke() calls.
Definition testobject.h:167
Options options() const
Getter for the flags property.
Definition testobject.h:112
QPointF m_pointF
Backing field.
Definition testobject.h:174
QSizeF m_sizeF
Backing field.
Definition testobject.h:176
void nudged(int amount=1)
Emitted by tests; the default argument makes moc add a clone, nudged().
int readOnly() const
A constant property.
Definition testobject.h:117
void poked()
Emitted by poke().
A gadget holding another gadget, like QGeoRectangle.
Definition testobject.h:48
double size
Length of a side.
Definition testobject.h:55
Coordinate corner
One corner.
Definition testobject.h:54
A gadget whose property holds another of its kind, without end.
Definition testobject.h:60
QVariant next() const
Another chain.
Definition testobject.h:66
A gadget like QGeoCoordinate: two writable properties and a read-only one.
Definition testobject.h:24
friend bool operator==(const Coordinate &a, const Coordinate &b)
Equal when both properties are (MEMBER properties of a gadget need it).
Definition testobject.h:38
friend bool operator!=(const Coordinate &a, const Coordinate &b)
Not equal.
Definition testobject.h:43
double longitude
Degrees east.
Definition testobject.h:32
bool isValid() const
Whether the coordinate is on the earth (a read-only property).
Definition testobject.h:35
double latitude
Degrees north.
Definition testobject.h:31
Opaque value type with no JSON or string conversion.
Definition testobject.h:18
int value
Payload.
Definition testobject.h:19