[Qt-qml] Q_INVOKABLE member function: Valid argument types
Johan Paul
johan.paul at gmail.com
Tue Oct 11 19:20:05 CEST 2011
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.
Cheers,
Johan
> Hi,
>
> What are the valid argument types of an invokable member function of a
> QML extension C++ class? I have noticed that these work:
>
> Q_INVOKABLE void myFunc1(int myInputInt);
> Q_INVOKABLE void myFunc2(int& myInputInt); // but myInputInt cannot
> be modified.
>
> while this does not work:
>
> Q_INVOKABLE void myFunc3(int * myOutputInt); // This will cause a
> runtime error when running qmlviewer.
>
> It appears that:
> 1. The argument can be an object of (or reference to) a basic C/C++ data
> type (int, int&, double, double&, ...).
> 2. The argument can be an object or (or reference to) a Qt class which
> relates to a basic QML type (QString, QString&, QVariant, QVariant&, ...).
> 3. The argument can be a pointer to QObject or its derived classes
> (QObject *, QWidget *, ...).
> ...
>
> Is there a Qt documentation page on this subject?
>
> Perhaps this is a related question: What are the valid return types of
> an invokable member function?
>
>
> Thanks,
>
> Jonathan
>
>
>
>
>
>
> Disclaimer: The information contained in this transmission, including any
> attachments, may contain confidential information of Panasonic Avionics
> Corporation. This transmission is intended only for the use of the
> addressee(s) listed above. Unauthorized review, dissemination or other use
> of the information contained in this transmission is strictly prohibited.
> If you have received this transmission in error or have reason to believe
> you are not authorized to receive it, please notify the sender by return
> email and promptly delete the transmission.
>
>
> _______________________________________________
> Qt-qml mailing list
> Qt-qml at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
More information about the Qt-qml
mailing list