summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/util.h')
-rw-r--r--tests/auto/widgets/util.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h
index 356cf6ebb..ab3b9e6b9 100644
--- a/tests/auto/widgets/util.h
+++ b/tests/auto/widgets/util.h
@@ -67,15 +67,16 @@ public:
};
template<typename T, typename R>
-struct RefWrapper {
- R &ref;
+struct CallbackWrapper {
+ QPointer<R> p;
void operator()(const T& result) {
- ref(result);
+ if (p)
+ (*p)(result);
}
};
template<typename T>
-class CallbackSpy {
+class CallbackSpy: public QObject {
public:
CallbackSpy() : called(false) {
timeoutTimer.setSingleShot(true);
@@ -100,10 +101,9 @@ public:
eventLoop.quit();
}
- // Cheap rip-off of boost/std::ref
- RefWrapper<T, CallbackSpy<T> > ref()
+ CallbackWrapper<T, CallbackSpy<T> > ref()
{
- RefWrapper<T, CallbackSpy<T> > wrapper = {*this};
+ CallbackWrapper<T, CallbackSpy<T> > wrapper = {this};
return wrapper;
}