[Qt-qml] Using C++ classes in signals on the QML side

aaron.kennedy at nokia.com aaron.kennedy at nokia.com
Tue Mar 30 02:42:31 CEST 2010


Hi,

On 29/03/10 11:33 PM, "ext Ademar de Souza Reis Jr."
<ademar.reis at openbossa.org> wrote:

>>> So as you can see using QTime and QString works, but using Boy doesn't. Any
>>> ideas?
>> 
>> Assuming Boy is a C++ class exposed to QML as you say, emitting it as a
>> pointer parameter should work.  For example
>> 
>> signals:
>>     void newGuestBoy(const Boy *guest)
>> 
> 
> It doesn't work either:

Sorry, this was my fault.  The correct signature is

signals:
    void newGuestBoy(Boy *guest)

JavaScript doesn't have the concept of const'ness, so QML can't reasonably
support it.  I'll investigate if we can make the warning message generated
for this slightly more comprehensible :)

Cheers,

Aaron





More information about the Qt-qml mailing list