summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobject.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qmetaobject.h')
-rw-r--r--src/corelib/kernel/qmetaobject.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 095b196dca..1c49506926 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -141,6 +141,20 @@ public:
inline bool isValid() const { return mobj != 0; }
+#ifdef Q_QDOC
+ static QMetaMethod fromSignal(PointerToMemberFunction signal);
+#else
+ template <typename Func>
+ static inline QMetaMethod fromSignal(Func signal)
+ {
+ typedef QtPrivate::FunctionPointer<Func> SignalType;
+ reinterpret_cast<typename SignalType::Object *>(0)->qt_check_for_QOBJECT_macro(
+ *reinterpret_cast<typename SignalType::Object *>(0));
+ return fromSignalImpl(&SignalType::Object::staticMetaObject,
+ reinterpret_cast<void **>(&signal));
+ }
+#endif
+
private:
#if QT_DEPRECATED_SINCE(5,0)
// signature() has been renamed to methodSignature() in Qt 5.
@@ -148,6 +162,7 @@ private:
// you convert to char*.
char *signature(struct renamedInQt5_warning_checkTheLifeTime * = 0) Q_DECL_EQ_DELETE;
#endif
+ static QMetaMethod fromSignalImpl(const QMetaObject *, void **);
const QMetaObject *mobj;
uint handle;
@@ -155,9 +170,16 @@ private:
friend struct QMetaObject;
friend struct QMetaObjectPrivate;
friend class QObject;
+ friend bool operator==(const QMetaMethod &m1, const QMetaMethod &m2);
+ friend bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2);
};
Q_DECLARE_TYPEINFO(QMetaMethod, Q_MOVABLE_TYPE);
+inline bool operator==(const QMetaMethod &m1, const QMetaMethod &m2)
+{ return m1.mobj == m2.mobj && m1.handle == m2.handle; }
+inline bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2)
+{ return !(m1 == m2); }
+
class Q_CORE_EXPORT QMetaEnum
{
public: