summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorLars Schmertmann <Lars.Schmertmann@governikus.de>2020-07-02 16:50:37 +0200
committerLars Schmertmann <Lars.Schmertmann@governikus.de>2020-07-06 11:29:39 +0200
commit4d661884d9209b1e597c8b0fe3dda37b5cf4205e (patch)
tree24a7001a915416c3e7b1b0ab25e03a87025d9fa5 /src/testlib
parent9e733622a605c841adf7da7304895758d307c843 (diff)
Use Q_DECL_UNUSED_MEMBER instead of Q_UNUSED
Task-number: QTBUG-82978 Change-Id: I7ff71e10b61cf5c2528ebef81cc49c648385fc33 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestevent.h42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h
index faad914a47..50eff69edc 100644
--- a/src/testlib/qtestevent.h
+++ b/src/testlib/qtestevent.h
@@ -58,6 +58,11 @@
QT_BEGIN_NAMESPACE
+#ifdef QT_WIDGETS_LIB
+# define QT_ONLY_WIDGETLIB_USES
+#else
+# define QT_ONLY_WIDGETLIB_USES Q_DECL_UNUSED_MEMBER
+#endif
class QTestEvent
{
@@ -103,10 +108,7 @@ class QTestKeyClicksEvent: public QTestEvent
{
public:
inline QTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay)
- : _keys(keys), _modifiers(modifiers), _delay(delay)
- {
- Q_UNUSED(_delay) // Silence -Werror,-Wunused-private-field
- }
+ : _keys(keys), _modifiers(modifiers), _delay(delay) {}
inline QTestEvent *clone() const override { return new QTestKeyClicksEvent(*this); }
#ifdef QT_WIDGETS_LIB
@@ -117,9 +119,9 @@ public:
#endif
private:
- QString _keys;
- Qt::KeyboardModifiers _modifiers;
- int _delay;
+ QT_ONLY_WIDGETLIB_USES QString _keys;
+ QT_ONLY_WIDGETLIB_USES Qt::KeyboardModifiers _modifiers;
+ QT_ONLY_WIDGETLIB_USES int _delay;
};
class QTestMouseEvent: public QTestEvent
@@ -127,12 +129,7 @@ class QTestMouseEvent: public QTestEvent
public:
inline QTestMouseEvent(QTest::MouseAction action, Qt::MouseButton button,
Qt::KeyboardModifiers modifiers, QPoint position, int delay)
- : _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay)
- {
- Q_UNUSED(_action)
- Q_UNUSED(_button)
- Q_UNUSED(_delay)
- }
+ : _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay) {}
inline QTestEvent *clone() const override { return new QTestMouseEvent(*this); }
#ifdef QT_WIDGETS_LIB
@@ -143,11 +140,11 @@ public:
#endif
private:
- QTest::MouseAction _action;
- Qt::MouseButton _button;
- Qt::KeyboardModifiers _modifiers;
- QPoint _pos;
- int _delay;
+ QT_ONLY_WIDGETLIB_USES QTest::MouseAction _action;
+ QT_ONLY_WIDGETLIB_USES Qt::MouseButton _button;
+ QT_ONLY_WIDGETLIB_USES Qt::KeyboardModifiers _modifiers;
+ QT_ONLY_WIDGETLIB_USES QPoint _pos;
+ QT_ONLY_WIDGETLIB_USES int _delay;
};
#endif //QT_GUI_LIB
@@ -155,10 +152,7 @@ private:
class QTestDelayEvent: public QTestEvent
{
public:
- inline QTestDelayEvent(int msecs): _delay(msecs)
- {
- Q_UNUSED(_delay)
- }
+ inline QTestDelayEvent(int msecs): _delay(msecs) {}
inline QTestEvent *clone() const override { return new QTestDelayEvent(*this); }
#ifdef QT_WIDGETS_LIB
@@ -166,7 +160,7 @@ public:
#endif
private:
- int _delay;
+ QT_ONLY_WIDGETLIB_USES int _delay;
};
class QTestEventList: public QList<QTestEvent *>
@@ -230,6 +224,8 @@ public:
#endif
};
+#undef QT_ONLY_WIDGETLIB_USES
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QTestEventList)