[Interest] QObject::connect returns true, but the connection does not work

Ch'Gans chgans at gna.org
Wed Feb 22 21:31:34 CET 2017


On 23 February 2017 at 09:31, Ch'Gans <chgans at gna.org> wrote:
> On 23 February 2017 at 09:08, Alexander Dyagilev <alervdvcw at gmail.com> wrote:
>> I think it would be a good idea to mention about this in the QSharedPointer
>> docs....

>From QMetaType documentation:
Declare new types with Q_DECLARE_METATYPE() to make them available to
QVariant and other template-based functions. Call qRegisterMetaType()
to make types available to non-template based functions, such as the
queued signal and slot connections.

Chris

>
>>
>>
>>
>> On 2/22/2017 11:07 PM, Alexander Dyagilev wrote:
>>>
>>> I googled; ok, it's a QSharedPointer.
>>>
>>>
>>> https://forum.qt.io/topic/6148/qsharedpointer-userdatatype-as-signal-slot-parameters/5
>>>
>>> Works fine now.
>>>
>>> I.e:
>>>
>>> "I think you need to register them. Make a typedef for
>>> QSharedPointer<UserDataType>, and use both Q_DECLARE_METATYPE as well as
>>> qRegisterMetaType() to register it for use."
>>>
>>>
>>> On 2/22/2017 10:33 PM, Alexander Dyagilev wrote:
>>>>
>>>> Why?
>>>>
>>>> emit is called; slot is NOT called.
>>>>
>>>> I use QSharedPointer<MyDataType> in slot/signal.
>>>>
>>>> MyDataType is a struct declared as metatype.
>>>>
>>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list