[Qt-qml] Q_INVOKABLE member function: Valid argument types

Girish Ramakrishnan girish at forwardbias.in
Tue Oct 11 19:46:08 CEST 2011


On Tue, Oct 11, 2011 at 10:50 PM, Johan Paul <johan.paul at gmail.com> wrote:
> Hi Jonathan,
>
> Q_INVOKABLEs are implements as slots in the C++ class, which means they
> are just method calls in the end. AFAIK you should be allowed to give a
> pointer to an integer if you so wish to a slot. Sounds like the runtime
> error (segfault?) comes from something else.
>
> You cannot return values from Q_INVOKABLES as they are Qt slots which
> cannot return values.
>

No, that's not correct. You can return values from Q_INVOKABLEs and
slots. You mark functions as 'slots' when they are candidates for
'connect'ing to as a signal/slot connection. You mark functions as
'invokables' when they are purely procedural functions (for eg.
rowCount(), removeItems()).

Girish


More information about the Qt-qml mailing list