[Qt-interest] QMetaObject and its method() function
Thiago Macieira
thiago at kde.org
Sat Jan 16 10:24:19 CET 2010
Em Sábado 16. Janeiro 2010, às 02.29.49, Louis Du Verdier escreveu:
> The only problem is that the "else" condition, about the method type, is
> never called, and only the signals and slots are shown on the tableWidget.
> If I create a private function (not a slot), this one is not shown on the
> window. I think it is because the meta-object system don't store this kind
> of function, but if someone can tell me if I am in the truth...
That is correct.
> But if it
> is not wrong, this means that the enums QMetaMethod::Method and
> QMetaMethod::Constructor do not have any utility ?
They do. It just happens that you have not run into any objects that have
them. Like you said yourself, moc will not extract and store information about
all methods. You have to tell it about the methods you want extracted.
By definition, slots and signals are methods you've told moc to extract
information on.
Try this object:
class Foo: public QObject
{
Q_OBJECT
public:
Q_INVOKABLE Foo(QObject *parent = 0);
Q_SLOT void slot();
Q_SIGNAL void somethingChanged();
Q_INVOKABLE void method();
Q_SCRIPTABLE void scriptableMethod();
void regularMethod();
public slots:
void slot2();
signals:
void somethingChanged2();
};
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100116/7c8ae977/attachment.bin
More information about the Qt-interest-old
mailing list