diff options
author | Jüri Valdmann <juri.valdmann@qt.io> | 2020-09-16 10:43:52 +0200 |
---|---|---|
committer | Jüri Valdmann <juri.valdmann@qt.io> | 2020-09-30 11:52:10 +0200 |
commit | 6403d3afd868bbdffddc52d8be0a56081637adf9 (patch) | |
tree | 71114d43e8f305aa5f34d9c98631ae27f7cfcba8 /tests/auto/widgets/util.h | |
parent | 23178283ecc10207cc5742aee9ded42d7cb60c8e (diff) |
Use less pointers in tst_loadsignals
Make QWebEngineView a member of tst_LoadSignals. Also stop recreating
it for every test.
Task-number: QTBUG-65223
Change-Id: I2ed7c12559e56e23302813eb6f33c1e26a9d8748
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
Diffstat (limited to 'tests/auto/widgets/util.h')
-rw-r--r-- | tests/auto/widgets/util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/widgets/util.h b/tests/auto/widgets/util.h index cb58f4243..af0b9bf6f 100644 --- a/tests/auto/widgets/util.h +++ b/tests/auto/widgets/util.h @@ -42,6 +42,17 @@ #define TESTS_SOURCE_DIR "" #endif +// Disconnect signal on destruction. +class ScopedConnection +{ +public: + ScopedConnection(QMetaObject::Connection connection) : m_connection(std::move(connection)) { } + ~ScopedConnection() { QObject::disconnect(m_connection); } + +private: + QMetaObject::Connection m_connection; +}; + /** * Just like QSignalSpy but facilitates sync and async * signal emission. For example if you want to verify that |