Fix usage of QObjectPrivate::connect when q_func() is private.
q_func() which is declared in Q_DECLARE_PUBLIC is usually private. We should use q_ptr directly in QObjectPrivate::connect, otherwise it does not compile when trying to access the private q_func Change-Id: I235165a0994327102dbb31c390c2cafdffe806dc Reviewed-by: Kurt Pattyn <pattyn.kurt@gmail.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
parent
b4c31488a7
commit
e13b0cc4a0
@ -338,7 +338,7 @@ inline QMetaObject::Connection QObjectPrivate::connect(const typename QtPrivate:
|
||||
types = QtPrivate::ConnectionTypes<typename SignalType::Arguments>::types();
|
||||
|
||||
return QObject::connectImpl(sender, reinterpret_cast<void **>(&signal),
|
||||
receiverPrivate->q_func(), reinterpret_cast<void **>(&slot),
|
||||
receiverPrivate->q_ptr, reinterpret_cast<void **>(&slot),
|
||||
new QtPrivate::QPrivateSlotObject<Func2, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotType::ArgumentCount>::Value,
|
||||
typename SignalType::ReturnType>(slot),
|
||||
type, types, &SignalType::Object::staticMetaObject);
|
||||
@ -356,7 +356,7 @@ bool QObjectPrivate::disconnect(const typename QtPrivate::FunctionPointer< Func1
|
||||
Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
|
||||
"Signal and slot arguments are not compatible.");
|
||||
return QObject::disconnectImpl(sender, reinterpret_cast<void **>(&signal),
|
||||
receiverPrivate->q_func(), reinterpret_cast<void **>(&slot),
|
||||
receiverPrivate->q_ptr, reinterpret_cast<void **>(&slot),
|
||||
&SignalType::Object::staticMetaObject);
|
||||
}
|
||||
|
||||
|
@ -5564,8 +5564,8 @@ public:
|
||||
};
|
||||
|
||||
class ConnectToPrivateSlotPrivate : public QObjectPrivate {
|
||||
public:
|
||||
Q_DECLARE_PUBLIC(ConnectToPrivateSlot)
|
||||
public:
|
||||
int receivedCount;
|
||||
QVariant receivedValue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user