[Qt-interest] QtScript: Making QList<QIcon> a scriptable type (like QStringList), how?
Wilhelm
wilhelm.meier at fh-kl.de
Wed Jan 19 10:38:15 CET 2011
Hi,
I like to make QList<QIcon> scriptable like QStringList, but I can't
figure out how to do that.
E.g., I have a
class Test : public QObject {
...
Q_INVOKABLE QStringList list1() {
return list(); // returns a QStringlist
}
...
};
If I make an instance of this class available in the qtscript-engine as
say object "test", then I can retrieve the stringlist:
(in qtscript):
sl = test.list1();
print(sl);
for(s in sl) {
print(sl[s]);
}
Now I want to do the same with a QList<QIcon> or similar. Say in the
class Test as above:
Q_INVOKABLE QList<QIcon> list2() {
return QList<QIcon> << QIcon() << QIcon();
}
and in qtscript should be possible:
il = test.list2();
icon = il[0];
print(icon.width);
Well, I experimented and googled, but I can't find the right way.
Any hints?
--
Wilhelm
More information about the Qt-interest-old
mailing list