4 int lqtL_qt_metacall (lua_State
*L
, QObject
*self
, QObject
*acceptor
,
5 QMetaObject::Call call
, const char *name
,
6 int index
, void **args
) {
7 int callindex
= 0, oldtop
= 0;
8 oldtop
= lua_gettop(L
);
9 lqtL_pushudata(L
, self
, name
); // (1)
10 lua_getfield(L
, -1, LQT_OBJSIGS
); // (2)
11 if (lua_isnil(L
, -1)) {
12 // TODO: determine what is wrong
13 lua_settop(L
, oldtop
);
14 QMetaObject::activate(self
, self
->metaObject(), index
, args
);
16 //qDebug() << lua_gettop(L) << luaL_typename(L, -1);
17 lua_rawgeti(L
, -1, index
+ 1); // (3)
18 if (!lua_isstring(L
, -1)) {
19 lua_settop(L
, oldtop
);
20 QMetaObject::activate(self
, self
->metaObject(), index
, args
);
22 callindex
= acceptor
->metaObject()->indexOfSlot(lua_tostring(L
, -1));
23 // qDebug() << "Found slot" << name << lua_tostring(L,-1) << "on" << acceptor->objectName() << "with index" << callindex;
25 lua_getfield(L
, -1, LQT_OBJSLOTS
); // (2)
26 lua_rawgeti(L
, -1, index
+1); // (3)
27 lua_remove(L
, -2); // (2)
28 index
= acceptor
->qt_metacall(call
, callindex
, args
);
29 lua_settop(L
, oldtop
);
36 const char add_method_func
[] =
37 "return function(qobj, signature, func)\n"
38 " local qname = 'LuaObject('..tostring(qobj)..')'\n"
39 " local stringdata = qobj['"LQT_OBJMETASTRING
"']\n"
40 " local data = qobj['"LQT_OBJMETADATA
"']\n"
41 " local slots = qobj['"LQT_OBJSLOTS
"']\n"
42 " local sigs = qobj['"LQT_OBJSIGS
"']\n"
43 " if stringdata==nil then\n"
44 " --print'adding a slot!'\n"
46 " stringdata = qname..'\\0'\n"
47 " data = setmetatable({}, {__index=table})\n"
48 " data:insert(1) -- revision\n"
49 " data:insert(0) -- class name\n"
50 " data:insert(0) -- class info (1)\n"
51 " data:insert(0) -- class info (2)\n"
52 " data:insert(0) -- number of methods\n"
53 " data:insert(10) -- beginning of methods\n"
54 " data:insert(0) -- number of properties\n"
55 " data:insert(0) -- beginning of properties\n"
56 " data:insert(0) -- number of enums/sets\n"
57 " data:insert(0) -- beginning of enums/sets\n"
58 " slots = setmetatable({}, {__index=table})\n"
59 " sigs = setmetatable({}, {__index=table})\n"
61 " local name, args = string.match(signature, '^(.*)(%b())$')\n"
62 " local arg_list = ''\n"
63 " if args=='()' then\n"
66 " local argnum = select(2, string.gsub(args, '.+,', ','))+1\n"
67 " for i = 1, argnum do\n"
68 " if i>1 then arg_list=arg_list..', ' end\n"
69 " arg_list = arg_list .. 'arg' .. i\n"
72 " --print(arg_list, signature)\n"
73 " local sig, params = #stringdata + #arg_list + 1, #stringdata -- , ty, tag, flags\n"
74 " stringdata = stringdata .. arg_list .. '\\0' .. signature .. '\\0'\n"
75 " data:insert(sig) -- print(sig, string.byte(stringdata, sig, sig+4), string.char(string.byte(stringdata, sig+1, sig+6)))\n"
76 " data:insert(params) -- print(params, string.char(string.byte(stringdata, params+1, params+10)))\n"
77 " data:insert(#stringdata-1) -- print(#stringdata-1, (string.byte(stringdata, #stringdata)))\n"
78 " data:insert(#stringdata-1) -- print(#stringdata-1, (string.byte(stringdata, #stringdata)))\n"
80 " data:insert(0x0a)\n"
81 " slots:insert(func)\n"
82 " sigs:insert('__slot'..signature:match'%b()')\n"
84 " data:insert(0x05)\n"
85 " slots:insert(false)\n"
86 " sigs:insert(false)\n"
88 " data[5] = data[5] + 1\n"
89 " qobj['"LQT_OBJMETASTRING
"'] = stringdata\n"
90 " qobj['"LQT_OBJMETADATA
"'] = data\n"
91 " qobj['"LQT_OBJSLOTS
"'] = slots\n"
92 " qobj['"LQT_OBJSIGS
"'] = sigs\n"
95 #include <QMetaObject>
96 #include <QMetaMethod>
98 #define CASE(x) case QMetaMethod::x : lua_pushstring(L, " " #x); break
99 static int lqtL_methods(lua_State
*L
) {
100 QObject
* self
= static_cast<QObject
*>(lqtL_toudata(L
, 1, "QObject*"));
102 return luaL_argerror(L
, 1, "expecting QObject*");
103 const QMetaObject
*mo
= self
->metaObject();
104 lua_createtable(L
, mo
->methodCount(), 0);
105 for (int i
=0; i
< mo
->methodCount(); i
++) {
106 QMetaMethod m
= mo
->method(i
);
107 lua_pushstring(L
, m
.signature());
108 switch (m
.access()) {
113 switch (m
.methodType()) {
120 lua_rawseti(L
, -2, i
+1);
126 static int lqtL_pushqobject(lua_State
*L
, QObject
* object
) {
127 const QMetaObject
* meta
= object
->metaObject();
129 QString className
= meta
->className();
131 char * cname
= strdup(qPrintable(className
));
132 lua_getfield(L
, LUA_REGISTRYINDEX
, cname
);
133 int isnil
= lua_isnil(L
, -1);
136 lqtL_pushudata(L
, object
, cname
);
141 meta
= meta
->superClass();
147 static int lqtL_findchild(lua_State
*L
) {
148 QObject
* self
= static_cast<QObject
*>(lqtL_toudata(L
, 1, "QObject*"));
150 return luaL_argerror(L
, 1, "expecting QObject*");
152 QString name
= luaL_checkstring(L
, 2);
153 QObject
* child
= self
->findChild
<QObject
*>(name
);
156 lqtL_pushqobject(L
, child
);
163 static int lqtL_children(lua_State
*L
) {
164 QObject
* self
= static_cast<QObject
*>(lqtL_toudata(L
, 1, "QObject*"));
166 return luaL_argerror(L
, 1, "expecting QObject*");
167 const QObjectList
& children
= self
->children();
170 for (int i
=0; i
< children
.count(); i
++) {
171 QObject
* object
= children
[i
];
172 QString name
= object
->objectName();
173 if (!name
.isEmpty() && lqtL_pushqobject(L
, object
)) {
174 lua_setfield(L
, -2, qPrintable(name
));
180 static int lqtL_connect(lua_State
*L
) {
181 static int methodId
= 0;
183 QObject
* sender
= static_cast<QObject
*>(lqtL_toudata(L
, 1, "QObject*"));
185 return luaL_argerror(L
, 1, "sender not QObject*");
187 const char *signal
= luaL_checkstring(L
, 2);
188 const QMetaObject
*senderMeta
= sender
->metaObject();
189 int idxS
= senderMeta
->indexOfSignal(signal
+ 1);
191 return luaL_argerror(L
, 2, qPrintable(QString("no such sender signal: '%1'").arg(signal
+ 1)));
196 if (lua_type(L
, 3) == LUA_TFUNCTION
) {
199 // simulate sender:__addmethod('LQT_SLOT_X(signature)', function()...end)
200 QMetaMethod m
= senderMeta
->method(idxS
);
201 methodName
= QString(m
.signature()).replace(QRegExp("^[^\\(]+"), QString("LQT_SLOT_%1").arg(methodId
++));
203 lua_getfield(L
, 1, "__addmethod");
205 lua_pushstring(L
, qPrintable(methodName
));
209 methodName
.prepend("1");
211 receiver
= static_cast<QObject
*>(lqtL_toudata(L
, 3, "QObject*"));
212 if (receiver
== NULL
)
213 return luaL_argerror(L
, 3, "receiver not QObject*");
214 const char *method
= luaL_checkstring(L
, 4);
217 const QMetaObject
*receiverMeta
= receiver
->metaObject();
218 int idxR
= receiverMeta
->indexOfMethod(method
+ 1);
220 return luaL_argerror(L
, 4, qPrintable(QString("no such receiver method: '%1'").arg(method
+ 1)));
223 bool ok
= QObject::connect(sender
, signal
, receiver
, qPrintable(methodName
));
224 lua_pushboolean(L
, ok
);
228 void lqtL_qobject_custom (lua_State
*L
) {
229 lua_getfield(L
, LUA_REGISTRYINDEX
, "QObject*");
230 int qobject
= lua_gettop(L
);
232 lua_pushstring(L
, "__addmethod");
233 luaL_dostring(L
, add_method_func
);
234 lua_rawset(L
, qobject
);
236 lua_pushstring(L
, "__methods");
237 lua_pushcfunction(L
, lqtL_methods
);
238 lua_rawset(L
, qobject
);
240 lua_pushstring(L
, "findChild");
241 lua_pushcfunction(L
, lqtL_findchild
);
242 lua_rawset(L
, qobject
);
244 lua_pushstring(L
, "children");
245 lua_pushcfunction(L
, lqtL_children
);
246 lua_rawset(L
, qobject
);
248 lua_pushstring(L
, "connect");
249 lua_pushcfunction(L
, lqtL_connect
);
250 lua_rawset(L
, qobject
);
252 // also modify the static QObject::connect function
253 lua_getfield(L
, LUA_GLOBALSINDEX
, "QObject");
254 lua_pushcfunction(L
, lqtL_connect
);
255 lua_setfield(L
, -2, "connect");
259 QList
<QByteArray
> lqtL_getStringList(lua_State
*L
, int i
) {
260 QList
<QByteArray
> ret
;
261 int n
= lua_objlen(L
, i
);
262 for (int i
=0; i
<n
; i
++) {
263 lua_pushnumber(L
, i
+1);
265 ret
[i
] = QByteArray(lua_tostring(L
, -1));
271 void lqtL_pushStringList(lua_State
*L
, const QList
<QByteArray
> &table
) {
272 const int n
= table
.size();
273 lua_createtable(L
, n
, 0);
274 for (int i
=0; i
<n
; i
++) {
275 lua_pushnumber(L
, i
+1);
276 lua_pushstring(L
, table
[i
].data());
284 #include <QByteArray>
288 #include <QEasingCurve>
290 #include <QKeySequence>
302 #include <QStringList>
315 #include <QMatrix4x4>
322 #include <QQuaternion>
324 #include <QSizePolicy>
325 #include <QTextFormat>
326 #include <QTextLength>
327 #include <QTransform>
333 int lqtL_qvariant_setValue(lua_State
*L
) {
334 QVariant
* self
= static_cast<QVariant
*>(lqtL_toudata(L
, 1, "QVariant*"));
335 lqtL_selfcheck(L
, self
, "QVariant");
337 if (lua_isnil(L
, 2)) {
339 } else if (lua_isboolean(L
, 2)) {
340 self
->setValue((bool)lua_toboolean(L
, 2));
341 } else if (lua_isnumber(L
, 2)) {
342 self
->setValue((double)lua_tonumber(L
, 2));
343 } else if (lua_isstring(L
, 2)) {
345 const char * str
= lua_tolstring(L
, 2, &size
);
346 self
->setValue(QByteArray(str
, size
));
348 else if (lqtL_testudata(L
, 2, "QBitArray*")) {
349 self
->setValue(*(QBitArray
*)lqtL_toudata(L
, 2, "QBitArray*"));
350 } else if (lqtL_testudata(L
, 2, "QByteArray*")) {
351 self
->setValue(*(QByteArray
*)lqtL_toudata(L
, 2, "QByteArray*"));
352 } else if (lqtL_testudata(L
, 2, "QChar*")) {
353 self
->setValue(*(QChar
*)lqtL_toudata(L
, 2, "QChar*"));
354 } else if (lqtL_testudata(L
, 2, "QDate*")) {
355 self
->setValue(*(QDate
*)lqtL_toudata(L
, 2, "QDate*"));
356 } else if (lqtL_testudata(L
, 2, "QDateTime*")) {
357 self
->setValue(*(QDateTime
*)lqtL_toudata(L
, 2, "QDateTime*"));
358 } else if (lqtL_testudata(L
, 2, "QKeySequence*")) {
359 self
->setValue(*(QKeySequence
*)lqtL_toudata(L
, 2, "QKeySequence*"));
360 } else if (lqtL_testudata(L
, 2, "QLine*")) {
361 self
->setValue(*(QLine
*)lqtL_toudata(L
, 2, "QLine*"));
362 } else if (lqtL_testudata(L
, 2, "QLineF*")) {
363 self
->setValue(*(QLineF
*)lqtL_toudata(L
, 2, "QLineF*"));
364 } else if (lqtL_testudata(L
, 2, "QList<QVariant>*")) {
365 self
->setValue(*(QList
<QVariant
>*)lqtL_toudata(L
, 2, "QList<QVariant>*"));
366 } else if (lqtL_testudata(L
, 2, "QLocale*")) {
367 self
->setValue(*(QLocale
*)lqtL_toudata(L
, 2, "QLocale*"));
368 } else if (lqtL_testudata(L
, 2, "QRect*")) {
369 self
->setValue(*(QRect
*)lqtL_toudata(L
, 2, "QRect*"));
370 } else if (lqtL_testudata(L
, 2, "QRectF*")) {
371 self
->setValue(*(QRectF
*)lqtL_toudata(L
, 2, "QRectF*"));
372 } else if (lqtL_testudata(L
, 2, "QRegExp*")) {
373 self
->setValue(*(QRegExp
*)lqtL_toudata(L
, 2, "QRegExp*"));
374 } else if (lqtL_testudata(L
, 2, "QSize*")) {
375 self
->setValue(*(QSize
*)lqtL_toudata(L
, 2, "QSize*"));
376 } else if (lqtL_testudata(L
, 2, "QSizeF*")) {
377 self
->setValue(*(QSizeF
*)lqtL_toudata(L
, 2, "QSizeF*"));
378 } else if (lqtL_testudata(L
, 2, "QString*")) {
379 self
->setValue(*(QString
*)lqtL_toudata(L
, 2, "QString*"));
380 } else if (lqtL_testudata(L
, 2, "QStringList*")) {
381 self
->setValue(*(QStringList
*)lqtL_toudata(L
, 2, "QStringList*"));
382 } else if (lqtL_testudata(L
, 2, "QTime*")) {
383 self
->setValue(*(QTime
*)lqtL_toudata(L
, 2, "QTime*"));
384 } else if (lqtL_testudata(L
, 2, "QUrl*")) {
385 self
->setValue(*(QUrl
*)lqtL_toudata(L
, 2, "QUrl*"));
389 else if (lqtL_testudata(L
, 2, "QBitmap*")) {
390 self
->setValue(*(QBitmap
*)lqtL_toudata(L
, 2, "QBitmap*"));
391 } else if (lqtL_testudata(L
, 2, "QBrush*")) {
392 self
->setValue(*(QBrush
*)lqtL_toudata(L
, 2, "QBrush*"));
393 } else if (lqtL_testudata(L
, 2, "QColor*")) {
394 self
->setValue(*(QColor
*)lqtL_toudata(L
, 2, "QColor*"));
395 } else if (lqtL_testudata(L
, 2, "QCursor*")) {
396 self
->setValue(*(QCursor
*)lqtL_toudata(L
, 2, "QCursor*"));
397 } else if (lqtL_testudata(L
, 2, "QFont*")) {
398 self
->setValue(*(QFont
*)lqtL_toudata(L
, 2, "QFont*"));
399 } else if (lqtL_testudata(L
, 2, "QIcon*")) {
400 self
->setValue(*(QIcon
*)lqtL_toudata(L
, 2, "QIcon*"));
401 } else if (lqtL_testudata(L
, 2, "QImage*")) {
402 self
->setValue(*(QImage
*)lqtL_toudata(L
, 2, "QImage*"));
403 } else if (lqtL_testudata(L
, 2, "QMatrix*")) {
404 self
->setValue(*(QMatrix
*)lqtL_toudata(L
, 2, "QMatrix*"));
405 } else if (lqtL_testudata(L
, 2, "QMatrix4x4*")) {
406 self
->setValue(*(QMatrix4x4
*)lqtL_toudata(L
, 2, "QMatrix4x4*"));
407 } else if (lqtL_testudata(L
, 2, "QPalette*")) {
408 self
->setValue(*(QPalette
*)lqtL_toudata(L
, 2, "QPalette*"));
409 } else if (lqtL_testudata(L
, 2, "QPen*")) {
410 self
->setValue(*(QPen
*)lqtL_toudata(L
, 2, "QPen*"));
411 } else if (lqtL_testudata(L
, 2, "QPoint*")) {
412 self
->setValue(*(QPoint
*)lqtL_toudata(L
, 2, "QPoint*"));
413 } else if (lqtL_testudata(L
, 2, "QPointF*")) {
414 self
->setValue(*(QPointF
*)lqtL_toudata(L
, 2, "QPointF*"));
415 } else if (lqtL_testudata(L
, 2, "QPixmap*")) {
416 self
->setValue(*(QPixmap
*)lqtL_toudata(L
, 2, "QPixmap*"));
417 } else if (lqtL_testudata(L
, 2, "QPolygon*")) {
418 self
->setValue(*(QPolygon
*)lqtL_toudata(L
, 2, "QPolygon*"));
419 } else if (lqtL_testudata(L
, 2, "QQuaternion*")) {
420 self
->setValue(*(QQuaternion
*)lqtL_toudata(L
, 2, "QQuaternion*"));
421 } else if (lqtL_testudata(L
, 2, "QRegion*")) {
422 self
->setValue(*(QRegion
*)lqtL_toudata(L
, 2, "QRegion*"));
423 } else if (lqtL_testudata(L
, 2, "QSizePolicy*")) {
424 self
->setValue(*(QSizePolicy
*)lqtL_toudata(L
, 2, "QSizePolicy*"));
425 } else if (lqtL_testudata(L
, 2, "QTextFormat*")) {
426 self
->setValue(*(QTextFormat
*)lqtL_toudata(L
, 2, "QTextFormat*"));
427 } else if (lqtL_testudata(L
, 2, "QTextLength*")) {
428 self
->setValue(*(QTextLength
*)lqtL_toudata(L
, 2, "QTextLength*"));
429 } else if (lqtL_testudata(L
, 2, "QTransform*")) {
430 self
->setValue(*(QTransform
*)lqtL_toudata(L
, 2, "QTransform*"));
431 } else if (lqtL_testudata(L
, 2, "QVector2D*")) {
432 self
->setValue(*(QVector2D
*)lqtL_toudata(L
, 2, "QVector2D*"));
433 } else if (lqtL_testudata(L
, 2, "QVector3D*")) {
434 self
->setValue(*(QVector3D
*)lqtL_toudata(L
, 2, "QVector3D*"));
435 } else if (lqtL_testudata(L
, 2, "QVector4D*")) {
436 self
->setValue(*(QVector4D
*)lqtL_toudata(L
, 2, "QVector4D*"));
442 int lqtL_qvariant_value(lua_State
*L
) {
443 QVariant
* self
= static_cast<QVariant
*>(lqtL_toudata(L
, 1, "QVariant*"));
444 lqtL_selfcheck(L
, self
, "QVariant");
446 if (lua_isnoneornil(L
, 2)) {
449 type
= (QVariant::Type
)lqtL_toenum(L
, 2, "QVariant.Type");
450 const char * currentType
= self
->typeName();
451 if (!self
->canConvert(type
) || !self
->convert(type
)) {
453 lua_pushfstring(L
, "cannot convert %s to %s", currentType
, self
->typeToName(type
));
457 switch (self
->type()) {
458 case QVariant::Invalid
: lua_pushnil(L
); return 1;
460 case QVariant::Bool
: lua_pushboolean(L
, self
->toBool()); return 1;
461 case QVariant::Double
: lua_pushnumber(L
, self
->toDouble()); return 1;
462 case QVariant::Int
: lua_pushinteger(L
, self
->toInt()); return 1;
463 case QVariant::UInt
: lua_pushinteger(L
, self
->toUInt()); return 1;
464 case QVariant::LongLong
: lua_pushnumber(L
, self
->toLongLong()); return 1;
465 case QVariant::ULongLong
: lua_pushnumber(L
, self
->toULongLong()); return 1;
466 case QVariant::ByteArray
: {
467 const QByteArray
&ba
= self
->toByteArray();
468 lua_pushlstring(L
, ba
.data(), ba
.size());
472 case QVariant::BitArray
: lqtL_passudata(L
, new QBitArray(self
->value
<QBitArray
>()), "QBitArray*"); return 1;
473 case QVariant::Char
: lqtL_passudata(L
, new QChar(self
->value
<QChar
>()), "QChar*"); return 1;
474 case QVariant::Date
: lqtL_passudata(L
, new QDate(self
->value
<QDate
>()), "QDate*"); return 1;
475 case QVariant::DateTime
: lqtL_passudata(L
, new QDateTime(self
->value
<QDateTime
>()), "QDateTime*"); return 1;
476 case QVariant::KeySequence
: lqtL_passudata(L
, new QKeySequence(self
->value
<QKeySequence
>()), "QKeySequence*"); return 1;
477 case QVariant::Line
: lqtL_passudata(L
, new QLine(self
->value
<QLine
>()), "QLine*"); return 1;
478 case QVariant::LineF
: lqtL_passudata(L
, new QLineF(self
->value
<QLineF
>()), "QLineF*"); return 1;
479 case QVariant::List
: lqtL_passudata(L
, new QList
<QVariant
>(self
->toList()), "QList<QVariant>*"); return 1;
480 case QVariant::Locale
: lqtL_passudata(L
, new QLocale(self
->value
<QLocale
>()), "QLocale*"); return 1;
481 case QVariant::Point
: lqtL_passudata(L
, new QPoint(self
->value
<QPoint
>()), "QPoint*"); return 1;
482 case QVariant::PointF
: lqtL_passudata(L
, new QPointF(self
->value
<QPointF
>()), "QPointF*"); return 1;
483 case QVariant::Rect
: lqtL_passudata(L
, new QRect(self
->value
<QRect
>()), "QRect*"); return 1;
484 case QVariant::RectF
: lqtL_passudata(L
, new QRectF(self
->value
<QRectF
>()), "QRectF*"); return 1;
485 case QVariant::RegExp
: lqtL_passudata(L
, new QRegExp(self
->value
<QRegExp
>()), "QRegExp*"); return 1;
486 case QVariant::Size
: lqtL_passudata(L
, new QSize(self
->value
<QSize
>()), "QSize*"); return 1;
487 case QVariant::SizeF
: lqtL_passudata(L
, new QSizeF(self
->value
<QSizeF
>()), "QSizeF*"); return 1;
488 case QVariant::String
: lqtL_passudata(L
, new QString(self
->value
<QString
>()), "QString*"); return 1;
489 case QVariant::StringList
: lqtL_passudata(L
, new QStringList(self
->value
<QStringList
>()), "QStringList*"); return 1;
490 case QVariant::Time
: lqtL_passudata(L
, new QTime(self
->value
<QTime
>()), "QTime*"); return 1;
491 case QVariant::Url
: lqtL_passudata(L
, new QUrl(self
->value
<QUrl
>()), "QUrl*"); return 1;
494 case QVariant::Bitmap
: lqtL_passudata(L
, new QBitmap(self
->value
<QBitmap
>()), "QBitmap*"); return 1;
495 case QVariant::Brush
: lqtL_passudata(L
, new QBrush(self
->value
<QBrush
>()), "QBrush*"); return 1;
496 case QVariant::Color
: lqtL_passudata(L
, new QColor(self
->value
<QColor
>()), "QColor*"); return 1;
497 case QVariant::Cursor
: lqtL_passudata(L
, new QCursor(self
->value
<QCursor
>()), "QCursor*"); return 1;
498 case QVariant::Font
: lqtL_passudata(L
, new QFont(self
->value
<QFont
>()), "QFont*"); return 1;
499 case QVariant::Icon
: lqtL_passudata(L
, new QIcon(self
->value
<QIcon
>()), "QIcon*"); return 1;
500 case QVariant::Image
: lqtL_passudata(L
, new QImage(self
->value
<QImage
>()), "QImage*"); return 1;
501 case QVariant::Matrix
: lqtL_passudata(L
, new QMatrix(self
->value
<QMatrix
>()), "QMatrix*"); return 1;
502 case QVariant::Matrix4x4
: lqtL_passudata(L
, new QMatrix4x4(self
->value
<QMatrix4x4
>()), "QMatrix4x4*"); return 1;
503 case QVariant::Palette
: lqtL_passudata(L
, new QPalette(self
->value
<QPalette
>()), "QPalette*"); return 1;
504 case QVariant::Pen
: lqtL_passudata(L
, new QPen(self
->value
<QPen
>()), "QPen*"); return 1;
505 case QVariant::Pixmap
: lqtL_passudata(L
, new QPixmap(self
->value
<QPixmap
>()), "QPixmap*"); return 1;
506 case QVariant::Polygon
: lqtL_passudata(L
, new QPolygon(self
->value
<QPolygon
>()), "QPolygon*"); return 1;
507 case QVariant::Quaternion
: lqtL_passudata(L
, new QQuaternion(self
->value
<QQuaternion
>()), "QQuaternion*"); return 1;
508 case QVariant::Region
: lqtL_passudata(L
, new QRegion(self
->value
<QRegion
>()), "QRegion*"); return 1;
509 case QVariant::SizePolicy
: lqtL_passudata(L
, new QSizePolicy(self
->value
<QSizePolicy
>()), "QSizePolicy*"); return 1;
510 case QVariant::Transform
: lqtL_passudata(L
, new QTransform(self
->value
<QTransform
>()), "QTransform*"); return 1;
511 case QVariant::TextFormat
: lqtL_passudata(L
, new QTextFormat(self
->value
<QTextFormat
>()), "QTextFormat*"); return 1;
512 case QVariant::TextLength
: lqtL_passudata(L
, new QTextLength(self
->value
<QTextLength
>()), "QTextLength*"); return 1;
513 case QVariant::Vector2D
: lqtL_passudata(L
, new QVector2D(self
->value
<QVector2D
>()), "QVector2D*"); return 1;
514 case QVariant::Vector3D
: lqtL_passudata(L
, new QVector3D(self
->value
<QVector3D
>()), "QVector3D*"); return 1;
515 case QVariant::Vector4D
: lqtL_passudata(L
, new QVector4D(self
->value
<QVector4D
>()), "QVector4D*"); return 1;
522 void lqtL_qvariant_custom(lua_State
*L
)
524 void lqtL_qvariant_custom_qtgui(lua_State
*L
)
527 lua_getfield(L
, LUA_REGISTRYINDEX
, "QVariant*");
528 int qvariant
= lua_gettop(L
);
530 lua_pushliteral(L
, "value");
531 lua_pushcfunction(L
, lqtL_qvariant_value
);
532 lua_rawset(L
, qvariant
);
534 lua_pushliteral(L
, "setValue");
535 lua_pushcfunction(L
, lqtL_qvariant_setValue
);
536 lua_rawset(L
, qvariant
);