object.h 821 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) Simon Brunel, https://github.com/simonbrunel
  3. *
  4. * This source code is licensed under the MIT license found in
  5. * the LICENSE file in the root directory of this source tree.
  6. */
  7. #ifndef QTPROMISE_TESTS_AUTO_SHARED_SENDER_H
  8. #define QTPROMISE_TESTS_AUTO_SHARED_SENDER_H
  9. #include <QtCore/QObject>
  10. class Object : public QObject
  11. {
  12. Q_OBJECT
  13. public:
  14. bool hasConnections() const { return m_connections > 0; }
  15. Q_SIGNALS:
  16. void noArgSignal();
  17. void oneArgSignal(const QString& v);
  18. void twoArgsSignal(int v1, const QString& v0);
  19. protected:
  20. int m_connections = 0;
  21. void connectNotify(const QMetaMethod&) Q_DECL_OVERRIDE { ++m_connections; }
  22. void disconnectNotify(const QMetaMethod&) Q_DECL_OVERRIDE { --m_connections; }
  23. };
  24. #endif // ifndef QTPROMISE_TESTS_AUTO_SHARED_SENDER_H