qtbindings 4.6.3.4 → 4.8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/KNOWN_ISSUES.txt +19 -5
- data/README.txt +119 -93
- data/Rakefile +28 -27
- data/examples/desktop/systray/window.rb +43 -47
- data/examples/draganddrop/dropsite/dropsitewidget.rb +10 -9
- data/examples/mainwindows/mdi/mainwindow.rb +4 -4
- data/examples/network/broadcastsender/sender.rb +3 -1
- data/examples/qtscribble/scribble.rb +270 -0
- data/examples/ruboids/LICENSE.txt +58 -0
- data/examples/run_all.rb +1 -0
- data/examples/textedit/textedit.rb +150 -0
- data/examples/widgets/scribble/scribblearea.rb +19 -19
- data/ext/cmake/modules/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/cmake/modules/FindLibraryWithDebug.cmake +113 -0
- data/ext/cmake/modules/FindPhonon.cmake +71 -0
- data/ext/cmake/modules/FindQImageBlitz.cmake +51 -0
- data/ext/cmake/modules/FindRuby.cmake +17 -17
- data/ext/cmake/modules/MacroOptionalFindPackage.cmake +6 -26
- data/ext/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/cmake/modules/SmokeConfig.cmake.in +109 -0
- data/ext/generator/cmake/BasicFindPackageVersion.cmake.in +30 -0
- data/ext/generator/cmake/CMakeLists.txt +24 -0
- data/ext/generator/cmake/FindLibraryWithDebug.cmake +113 -0
- data/ext/generator/cmake/FindPhonon.cmake +71 -0
- data/ext/generator/cmake/FindQImageBlitz.cmake +51 -0
- data/ext/generator/cmake/FindQScintilla.cmake +57 -0
- data/ext/generator/cmake/FindQwt5.cmake +104 -0
- data/ext/generator/cmake/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
- data/ext/generator/cmake/MacroLogFeature.cmake +146 -0
- data/ext/generator/cmake/MacroOptionalAddBindings.cmake +47 -0
- data/ext/generator/cmake/MacroOptionalFindPackage.cmake +28 -0
- data/ext/generator/cmake/MacroWriteBasicCMakeVersionFile.cmake +22 -0
- data/ext/generator/cmake/SmokeConfig.cmake.in +109 -0
- data/ext/generator/config.h +25 -0
- data/ext/generator/generatorpreprocessor.cpp +60 -41
- data/ext/generator/generators/dump/CMakeLists.txt +5 -0
- data/ext/generator/generators/smoke/CMakeLists.txt +5 -0
- data/ext/generator/generators/smoke/globals.h +3 -1
- data/ext/generator/generators/smoke/helpers.cpp +21 -2
- data/ext/generator/generators/smoke/writeSmokeDataFile.cpp +26 -1
- data/ext/generator/main.cpp +5 -1
- data/ext/generator/options.cpp +1 -0
- data/ext/generator/options.h +1 -0
- data/ext/generator/parser/CMakeLists.txt +10 -1
- data/ext/generator/parser/parser.cpp +6 -6
- data/ext/generator/parser/parser.h +2 -12
- data/ext/generator/parser/parsesession.cpp +1 -0
- data/ext/generator/parser/rpp/CMakeLists.txt +6 -0
- data/ext/generator/parser/rpp/chartools.cpp +3 -3
- data/ext/generator/parser/rpp/chartools.h +3 -1
- data/ext/generator/parser/rpp/pp-scanner.cpp +2 -1
- data/ext/generator/parser/rpp/tests/CMakeLists.txt +4 -0
- data/ext/generator/parser/tests/CMakeLists.txt +16 -0
- data/ext/generator/smoke.h +557 -0
- data/ext/generator/smokegen_string.h +43 -0
- data/ext/generator/type.cpp +15 -6
- data/ext/generator/type_compiler.cpp +2 -0
- data/ext/ruby/qtruby/src/qtruby.cpp +147 -143
- data/ext/ruby/qttest/qttesthandlers.cpp +1 -0
- data/ext/smoke/qtcore/QtGuess.txt +23 -25
- data/ext/smoke/qtcore/smokeconfig.xml +1 -0
- data/ext/smoke/qtdbus/smokeconfig.xml +2 -0
- data/ext/smoke/qtgui/smokeconfig.xml +14 -4
- data/ext/smoke/qthelp/smokeconfig.xml +1 -0
- data/ext/smoke/qtmultimedia/smokeconfig.xml +1 -0
- data/ext/smoke/qtnetwork/smokeconfig.xml +2 -0
- data/ext/smoke/qtopengl/smokeconfig.xml +1 -0
- data/ext/smoke/qtsql/smokeconfig.xml +1 -0
- data/ext/smoke/qtsvg/smokeconfig.xml +1 -0
- data/ext/smoke/qtwebkit/smokeconfig.xml +3 -0
- data/extconf.rb +37 -23
- data/lib/Qt/qtruby4.rb +4 -4
- data/lib/Qt4.rb +1 -1
- data/lib/qtbindings_version.rb +2 -2
- metadata +50 -40
@@ -0,0 +1,43 @@
|
|
1
|
+
// smokegen uses this file instead of /usr/include/string.h because
|
2
|
+
// it chokes on some of gcc's language additions.
|
3
|
+
|
4
|
+
#ifndef _STRING_H
|
5
|
+
#define _STRING_H 1
|
6
|
+
|
7
|
+
#include <stddef.h>
|
8
|
+
|
9
|
+
void *memccpy(void *, const void *, int, size_t);
|
10
|
+
|
11
|
+
void *memchr(const void *, int, size_t);
|
12
|
+
int memcmp(const void *, const void *, size_t);
|
13
|
+
void *memcpy(void *, const void *, size_t);
|
14
|
+
void *memmove(void *, const void *, size_t);
|
15
|
+
void *memset(void *, int, size_t);
|
16
|
+
char *strcat(char *, const char *);
|
17
|
+
char *strchr(const char *, int);
|
18
|
+
int strcmp(const char *, const char *);
|
19
|
+
int strcoll(const char *, const char *);
|
20
|
+
char *strcpy(char *, const char *);
|
21
|
+
size_t strcspn(const char *, const char *);
|
22
|
+
|
23
|
+
char *strdup(const char *);
|
24
|
+
|
25
|
+
char *strerror(int);
|
26
|
+
|
27
|
+
int *strerror_r(int, char *, size_t);
|
28
|
+
|
29
|
+
size_t strlen(const char *);
|
30
|
+
char *strncat(char *, const char *, size_t);
|
31
|
+
int strncmp(const char *, const char *, size_t);
|
32
|
+
char *strncpy(char *, const char *, size_t);
|
33
|
+
char *strpbrk(const char *, const char *);
|
34
|
+
char *strrchr(const char *, int);
|
35
|
+
size_t strspn(const char *, const char *);
|
36
|
+
char *strstr(const char *, const char *);
|
37
|
+
char *strtok(char *, const char *);
|
38
|
+
|
39
|
+
char *strtok_r(char *, const char *, char **);
|
40
|
+
|
41
|
+
size_t strxfrm(char *, const char *, size_t);
|
42
|
+
|
43
|
+
#endif // _STRING_H
|
data/ext/generator/type.cpp
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
*/
|
18
18
|
|
19
19
|
#include "type.h"
|
20
|
+
#include "options.h"
|
20
21
|
|
21
22
|
QHash<QString, Class> classes;
|
22
23
|
QHash<QString, Typedef> typedefs;
|
@@ -104,11 +105,12 @@ Type* Type::registerType(const Type& type)
|
|
104
105
|
Type Typedef::resolve() const {
|
105
106
|
bool isRef = false, isConst = false, isVolatile = false;
|
106
107
|
QList<bool> pointerDepth;
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
108
|
+
|
109
|
+
// not pretty, but safe. 'this' (without const) will never be returned or modified from here on.
|
110
|
+
const Type tmp(const_cast<Typedef*>(this));
|
111
|
+
const Type* t = &tmp;
|
112
|
+
|
113
|
+
while (t->getTypedef() && !ParserOptions::notToBeResolved.contains(t->getTypedef()->name())) {
|
112
114
|
if (!isRef) isRef = t->isRef();
|
113
115
|
if (!isConst) isConst = t->isConst();
|
114
116
|
if (!isVolatile) isVolatile = t->isVolatile();
|
@@ -118,10 +120,17 @@ Type Typedef::resolve() const {
|
|
118
120
|
}
|
119
121
|
}
|
120
122
|
Type ret = *t;
|
123
|
+
|
124
|
+
// not fully resolved -> erase the typedef pointer and only set a name
|
125
|
+
if (ret.getTypedef()) {
|
126
|
+
ret.setName(ret.getTypedef()->name());
|
127
|
+
ret.setTypedef(0);
|
128
|
+
}
|
129
|
+
|
121
130
|
if (isRef) ret.setIsRef(true);
|
122
131
|
if (isConst) ret.setIsConst(true);
|
123
132
|
if (isVolatile) ret.setIsVolatile(true);
|
124
|
-
|
133
|
+
|
125
134
|
ret.setPointerDepth(pointerDepth.count());
|
126
135
|
for (int i = 0; i < pointerDepth.count(); i++) {
|
127
136
|
ret.setIsConstPointer(i, pointerDepth[i]);
|
@@ -191,6 +191,8 @@ void TypeCompiler::visitParameterDeclaration(ParameterDeclarationAST* node)
|
|
191
191
|
|
192
192
|
void TypeCompiler::visitPtrOperator(PtrOperatorAST* node)
|
193
193
|
{
|
194
|
+
if ( ! m_session->token_stream ) return;
|
195
|
+
if ( ! token_text(m_session->token_stream->kind(node->op)) ) return;
|
194
196
|
if (token_text(m_session->token_stream->kind(node->op))[0] == '*') {
|
195
197
|
QPair<bool, bool> cv = m_visitor->parseCv(node->cv);
|
196
198
|
pointerDepth.append(cv.first);
|
@@ -15,28 +15,28 @@
|
|
15
15
|
* *
|
16
16
|
***************************************************************************/
|
17
17
|
|
18
|
-
#include <QtCore/qabstractitemmodel.h>
|
18
|
+
#include <QtCore/qabstractitemmodel.h>
|
19
19
|
#include <QtCore/qglobal.h>
|
20
20
|
#include <QtCore/qhash.h>
|
21
|
-
#include <QtCore/qline.h>
|
21
|
+
#include <QtCore/qline.h>
|
22
22
|
#include <QtCore/qmetaobject.h>
|
23
23
|
#include <QtCore/qobject.h>
|
24
|
-
#include <QtCore/qrect.h>
|
24
|
+
#include <QtCore/qrect.h>
|
25
25
|
#include <QtCore/qregexp.h>
|
26
26
|
#include <QtCore/qstring.h>
|
27
27
|
#include <QtCore/qvariant.h>
|
28
28
|
#include <QtGui/qapplication.h>
|
29
|
-
#include <QtGui/qbitmap.h>
|
30
|
-
#include <QtGui/qcolor.h>
|
29
|
+
#include <QtGui/qbitmap.h>
|
30
|
+
#include <QtGui/qcolor.h>
|
31
31
|
#include <QtGui/qcursor.h>
|
32
|
-
#include <QtGui/qfont.h>
|
33
|
-
#include <QtGui/qicon.h>
|
32
|
+
#include <QtGui/qfont.h>
|
33
|
+
#include <QtGui/qicon.h>
|
34
34
|
#include <QtGui/qitemselectionmodel.h>
|
35
|
-
#include <QtGui/qpalette.h>
|
36
|
-
#include <QtGui/qpen.h>
|
37
|
-
#include <QtGui/qpixmap.h>
|
38
|
-
#include <QtGui/qpolygon.h>
|
39
|
-
#include <QtGui/qtextformat.h>
|
35
|
+
#include <QtGui/qpalette.h>
|
36
|
+
#include <QtGui/qpen.h>
|
37
|
+
#include <QtGui/qpixmap.h>
|
38
|
+
#include <QtGui/qpolygon.h>
|
39
|
+
#include <QtGui/qtextformat.h>
|
40
40
|
#include <QtGui/qwidget.h>
|
41
41
|
|
42
42
|
#ifdef QT_QTDBUS
|
@@ -107,28 +107,28 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
107
107
|
QMetaEnum e = property.enumerator();
|
108
108
|
return QString(" %1=%2::%3").arg(name).arg(e.scope()).arg(e.valueToKey(value.toInt()));
|
109
109
|
}
|
110
|
-
|
110
|
+
|
111
111
|
switch (value.type()) {
|
112
112
|
case QVariant::String:
|
113
113
|
{
|
114
114
|
if (value.toString().isNull()) {
|
115
|
-
return QString(" %1=nil").arg(name);
|
115
|
+
return QString(" %1=nil").arg(name);
|
116
116
|
} else {
|
117
117
|
return QString(" %1=%2").arg(name).arg(value.toString());
|
118
118
|
}
|
119
119
|
}
|
120
|
-
|
120
|
+
|
121
121
|
case QVariant::Bool:
|
122
122
|
{
|
123
123
|
QString rubyName;
|
124
124
|
QRegExp name_re("^(is|has)(.)(.*)");
|
125
|
-
|
125
|
+
|
126
126
|
if (name_re.indexIn(name) != -1) {
|
127
127
|
rubyName = name_re.cap(2).toLower() + name_re.cap(3) + "?";
|
128
128
|
} else {
|
129
129
|
rubyName = name;
|
130
130
|
}
|
131
|
-
|
131
|
+
|
132
132
|
return QString(" %1=%2").arg(rubyName).arg(value.toString());
|
133
133
|
}
|
134
134
|
|
@@ -137,18 +137,18 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
137
137
|
QColor c = value.value<QColor>();
|
138
138
|
return QString(" %1=#<Qt::Color:0x0 %2>").arg(name).arg(c.name());
|
139
139
|
}
|
140
|
-
|
140
|
+
|
141
141
|
case QVariant::Cursor:
|
142
142
|
{
|
143
143
|
QCursor c = value.value<QCursor>();
|
144
144
|
return QString(" %1=#<Qt::Cursor:0x0 shape=%2>").arg(name).arg(c.shape());
|
145
145
|
}
|
146
|
-
|
146
|
+
|
147
147
|
case QVariant::Double:
|
148
148
|
{
|
149
149
|
return QString(" %1=%2").arg(name).arg(value.toDouble());
|
150
150
|
}
|
151
|
-
|
151
|
+
|
152
152
|
case QVariant::Font:
|
153
153
|
{
|
154
154
|
QFont f = value.value<QFont>();
|
@@ -162,7 +162,7 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
162
162
|
.arg(f.underline() ? "true" : "false")
|
163
163
|
.arg(f.strikeOut() ? "true" : "false");
|
164
164
|
}
|
165
|
-
|
165
|
+
|
166
166
|
case QVariant::Line:
|
167
167
|
{
|
168
168
|
QLine l = value.toLine();
|
@@ -173,7 +173,7 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
173
173
|
.arg(l.x2())
|
174
174
|
.arg(l.y2());
|
175
175
|
}
|
176
|
-
|
176
|
+
|
177
177
|
case QVariant::LineF:
|
178
178
|
{
|
179
179
|
QLineF l = value.toLineF();
|
@@ -184,19 +184,19 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
184
184
|
.arg(l.x2())
|
185
185
|
.arg(l.y2());
|
186
186
|
}
|
187
|
-
|
187
|
+
|
188
188
|
case QVariant::Point:
|
189
189
|
{
|
190
190
|
QPoint p = value.toPoint();
|
191
191
|
return QString(" %1=#<Qt::Point:0x0 x=%2, y=%3>").arg(name).arg(p.x()).arg(p.y());
|
192
192
|
}
|
193
|
-
|
193
|
+
|
194
194
|
case QVariant::PointF:
|
195
195
|
{
|
196
196
|
QPointF p = value.toPointF();
|
197
197
|
return QString(" %1=#<Qt::PointF:0x0 x=%2, y=%3>").arg(name).arg(p.x()).arg(p.y());
|
198
198
|
}
|
199
|
-
|
199
|
+
|
200
200
|
case QVariant::Rect:
|
201
201
|
{
|
202
202
|
QRect r = value.toRect();
|
@@ -204,7 +204,7 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
204
204
|
.arg(name)
|
205
205
|
.arg(r.left()).arg(r.right()).arg(r.top()).arg(r.bottom());
|
206
206
|
}
|
207
|
-
|
207
|
+
|
208
208
|
case QVariant::RectF:
|
209
209
|
{
|
210
210
|
QRectF r = value.toRectF();
|
@@ -212,23 +212,23 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
212
212
|
.arg(name)
|
213
213
|
.arg(r.left()).arg(r.right()).arg(r.top()).arg(r.bottom());
|
214
214
|
}
|
215
|
-
|
215
|
+
|
216
216
|
case QVariant::Size:
|
217
217
|
{
|
218
218
|
QSize s = value.toSize();
|
219
219
|
return QString(" %1=#<Qt::Size:0x0 width=%2, height=%3>")
|
220
|
-
.arg(name)
|
220
|
+
.arg(name)
|
221
221
|
.arg(s.width()).arg(s.height());
|
222
222
|
}
|
223
|
-
|
223
|
+
|
224
224
|
case QVariant::SizeF:
|
225
225
|
{
|
226
226
|
QSizeF s = value.toSizeF();
|
227
227
|
return QString(" %1=#<Qt::SizeF:0x0 width=%2, height=%3>")
|
228
|
-
.arg(name)
|
228
|
+
.arg(name)
|
229
229
|
.arg(s.width()).arg(s.height());
|
230
230
|
}
|
231
|
-
|
231
|
+
|
232
232
|
case QVariant::SizePolicy:
|
233
233
|
{
|
234
234
|
QSizePolicy s = value.value<QSizePolicy>();
|
@@ -237,7 +237,7 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
237
237
|
.arg(s.horizontalPolicy())
|
238
238
|
.arg(s.verticalPolicy());
|
239
239
|
}
|
240
|
-
|
240
|
+
|
241
241
|
case QVariant::Brush:
|
242
242
|
// case QVariant::ColorGroup:
|
243
243
|
case QVariant::Image:
|
@@ -247,7 +247,7 @@ inspectProperty(QMetaProperty property, const char * name, QVariant & value)
|
|
247
247
|
{
|
248
248
|
return QString(" %1=#<Qt::%2:0x0>").arg(name).arg(value.typeName() + 1);
|
249
249
|
}
|
250
|
-
|
250
|
+
|
251
251
|
default:
|
252
252
|
return QString(" %1=%2").arg(name)
|
253
253
|
.arg((value.isNull() || value.toString().isNull()) ? "nil" : value.toString() );
|
@@ -265,31 +265,31 @@ inspect_qobject(VALUE self)
|
|
265
265
|
if (TYPE(self) != T_DATA) {
|
266
266
|
return Qnil;
|
267
267
|
}
|
268
|
-
|
268
|
+
|
269
269
|
// Start with #<Qt::HBoxLayout:0x30139030> from the original inspect() call
|
270
270
|
// Drop the closing '>'
|
271
|
-
VALUE inspect_str = rb_call_super(0, 0);
|
271
|
+
VALUE inspect_str = rb_call_super(0, 0);
|
272
272
|
rb_str_resize(inspect_str, RSTRING_LEN(inspect_str) - 1);
|
273
|
-
|
273
|
+
|
274
274
|
smokeruby_object * o = 0;
|
275
|
-
Data_Get_Struct(self, smokeruby_object, o);
|
275
|
+
Data_Get_Struct(self, smokeruby_object, o);
|
276
276
|
QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
277
|
-
|
277
|
+
|
278
278
|
QString value_list;
|
279
279
|
value_list.append(QString(" objectName=\"%1\"").arg(qobject->objectName()));
|
280
|
-
|
280
|
+
|
281
281
|
if (qobject->isWidgetType()) {
|
282
282
|
QWidget * w = (QWidget *) qobject;
|
283
283
|
value_list.append(QString(", x=%1, y=%2, width=%3, height=%4")
|
284
284
|
.arg(w->x())
|
285
285
|
.arg(w->y())
|
286
286
|
.arg(w->width())
|
287
|
-
.arg(w->height()) );
|
287
|
+
.arg(w->height()) );
|
288
288
|
}
|
289
|
-
|
289
|
+
|
290
290
|
value_list.append(">");
|
291
291
|
rb_str_cat2(inspect_str, value_list.toLatin1());
|
292
|
-
|
292
|
+
|
293
293
|
return inspect_str;
|
294
294
|
}
|
295
295
|
|
@@ -308,31 +308,31 @@ pretty_print_qobject(VALUE self, VALUE pp)
|
|
308
308
|
if (TYPE(self) != T_DATA) {
|
309
309
|
return Qnil;
|
310
310
|
}
|
311
|
-
|
311
|
+
|
312
312
|
// Start with #<Qt::HBoxLayout:0x30139030>
|
313
313
|
// Drop the closing '>'
|
314
|
-
VALUE inspect_str = rb_funcall(self, rb_intern("to_s"), 0, 0);
|
314
|
+
VALUE inspect_str = rb_funcall(self, rb_intern("to_s"), 0, 0);
|
315
315
|
rb_str_resize(inspect_str, RSTRING_LEN(inspect_str) - 1);
|
316
316
|
rb_funcall(pp, rb_intern("text"), 1, inspect_str);
|
317
317
|
rb_funcall(pp, rb_intern("breakable"), 0);
|
318
|
-
|
318
|
+
|
319
319
|
smokeruby_object * o = 0;
|
320
|
-
Data_Get_Struct(self, smokeruby_object, o);
|
320
|
+
Data_Get_Struct(self, smokeruby_object, o);
|
321
321
|
QObject * qobject = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
322
|
-
|
323
|
-
QString value_list;
|
324
|
-
|
322
|
+
|
323
|
+
QString value_list;
|
324
|
+
|
325
325
|
if (qobject->parent() != 0) {
|
326
326
|
QString parentInspectString;
|
327
327
|
VALUE obj = getPointerObject(qobject->parent());
|
328
328
|
if (obj != Qnil) {
|
329
|
-
VALUE parent_inspect_str = rb_funcall(obj, rb_intern("to_s"), 0, 0);
|
329
|
+
VALUE parent_inspect_str = rb_funcall(obj, rb_intern("to_s"), 0, 0);
|
330
330
|
rb_str_resize(parent_inspect_str, RSTRING_LEN(parent_inspect_str) - 1);
|
331
331
|
parentInspectString = StringValuePtr(parent_inspect_str);
|
332
332
|
} else {
|
333
333
|
parentInspectString.sprintf("#<%s:0x0", qobject->parent()->metaObject()->className());
|
334
334
|
}
|
335
|
-
|
335
|
+
|
336
336
|
if (qobject->parent()->isWidgetType()) {
|
337
337
|
QWidget * w = (QWidget *) qobject->parent();
|
338
338
|
value_list = QString(" parent=%1 objectName=\"%2\", x=%3, y=%4, width=%5, height=%6>,\n")
|
@@ -347,24 +347,24 @@ pretty_print_qobject(VALUE self, VALUE pp)
|
|
347
347
|
.arg(parentInspectString)
|
348
348
|
.arg(qobject->parent()->objectName());
|
349
349
|
}
|
350
|
-
|
350
|
+
|
351
351
|
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
352
352
|
}
|
353
|
-
|
353
|
+
|
354
354
|
if (qobject->children().count() != 0) {
|
355
355
|
value_list = QString(" children=Array (%1 element(s)),\n")
|
356
356
|
.arg(qobject->children().count());
|
357
357
|
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
358
358
|
}
|
359
|
-
|
359
|
+
|
360
360
|
value_list = QString(" metaObject=#<Qt::MetaObject:0x0");
|
361
361
|
value_list.append(QString(" className=%1").arg(qobject->metaObject()->className()));
|
362
|
-
|
362
|
+
|
363
363
|
if (qobject->metaObject()->superClass() != 0) {
|
364
364
|
value_list.append( QString(", superClass=#<Qt::MetaObject:0x0 className=%1>")
|
365
365
|
.arg(qobject->metaObject()->superClass()->className()) );
|
366
|
-
}
|
367
|
-
|
366
|
+
}
|
367
|
+
|
368
368
|
value_list.append(">,\n");
|
369
369
|
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(value_list.toLatin1()));
|
370
370
|
|
@@ -383,7 +383,7 @@ pretty_print_qobject(VALUE self, VALUE pp)
|
|
383
383
|
}
|
384
384
|
|
385
385
|
rb_funcall(pp, rb_intern("text"), 1, rb_str_new2(">"));
|
386
|
-
|
386
|
+
|
387
387
|
return self;
|
388
388
|
}
|
389
389
|
|
@@ -470,9 +470,9 @@ qabstract_item_model_data(int argc, VALUE * argv, VALUE self)
|
|
470
470
|
}
|
471
471
|
|
472
472
|
|
473
|
-
smokeruby_object * result = alloc_smokeruby_object( true,
|
474
|
-
o->smoke,
|
475
|
-
o->smoke->findClass("QVariant").index,
|
473
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
474
|
+
o->smoke,
|
475
|
+
o->smoke->findClass("QVariant").index,
|
476
476
|
new QVariant(value) );
|
477
477
|
return set_obj_info("Qt::Variant", result);
|
478
478
|
}
|
@@ -492,7 +492,7 @@ qabstract_item_model_setdata(int argc, VALUE * argv, VALUE self)
|
|
492
492
|
}
|
493
493
|
|
494
494
|
if (argc == 3) {
|
495
|
-
return (model->setData( *modelIndex,
|
495
|
+
return (model->setData( *modelIndex,
|
496
496
|
*variant,
|
497
497
|
NUM2INT(rb_funcall(argv[2], rb_intern("to_i"), 0)) ) ? Qtrue : Qfalse);
|
498
498
|
}
|
@@ -624,7 +624,7 @@ qimage_scan_line(VALUE self, VALUE ix)
|
|
624
624
|
return rb_str_new((const char *) bytes, image->bytesPerLine());
|
625
625
|
}
|
626
626
|
|
627
|
-
#ifdef QT_QTDBUS
|
627
|
+
#ifdef QT_QTDBUS
|
628
628
|
static VALUE
|
629
629
|
qdbusargument_endarraywrite(VALUE self)
|
630
630
|
{
|
@@ -795,9 +795,9 @@ qabstractitemmodel_createindex(int argc, VALUE * argv, VALUE self)
|
|
795
795
|
stack[3].s_voidp = (void*) argv[2];
|
796
796
|
}
|
797
797
|
(*fn)(m.method, o->ptr, stack);
|
798
|
-
smokeruby_object * result = alloc_smokeruby_object( true,
|
799
|
-
o->smoke,
|
800
|
-
o->smoke->idClass("QModelIndex").index,
|
798
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
799
|
+
o->smoke,
|
800
|
+
o->smoke->idClass("QModelIndex").index,
|
801
801
|
stack[0].s_voidp );
|
802
802
|
|
803
803
|
return set_obj_info("Qt::ModelIndex", result);
|
@@ -826,9 +826,9 @@ qitemselection_at(VALUE self, VALUE i)
|
|
826
826
|
QItemSelection * item = (QItemSelection *) o->ptr;
|
827
827
|
QItemSelectionRange range = item->at(NUM2INT(i));
|
828
828
|
|
829
|
-
smokeruby_object * result = alloc_smokeruby_object( true,
|
830
|
-
o->smoke,
|
831
|
-
o->smoke->idClass("QItemSelectionRange").index,
|
829
|
+
smokeruby_object * result = alloc_smokeruby_object( true,
|
830
|
+
o->smoke,
|
831
|
+
o->smoke->idClass("QItemSelectionRange").index,
|
832
832
|
new QItemSelectionRange(range) );
|
833
833
|
|
834
834
|
return set_obj_info("Qt::ItemSelectionRange", result);
|
@@ -851,7 +851,7 @@ metaObject(VALUE self)
|
|
851
851
|
|
852
852
|
/* This shouldn't be needed, but kalyptus doesn't generate a staticMetaObject
|
853
853
|
method for QObject::staticMetaObject, although it does for all the other
|
854
|
-
classes, and it isn't obvious what the problem with it is.
|
854
|
+
classes, and it isn't obvious what the problem with it is.
|
855
855
|
So add this as a hack to work round the bug.
|
856
856
|
*/
|
857
857
|
static VALUE
|
@@ -859,9 +859,9 @@ qobject_staticmetaobject(VALUE /*klass*/)
|
|
859
859
|
{
|
860
860
|
QMetaObject * meta = new QMetaObject(QObject::staticMetaObject);
|
861
861
|
|
862
|
-
smokeruby_object * m = alloc_smokeruby_object( true,
|
863
|
-
qtcore_Smoke,
|
864
|
-
qtcore_Smoke->idClass("QMetaObject").index,
|
862
|
+
smokeruby_object * m = alloc_smokeruby_object( true,
|
863
|
+
qtcore_Smoke,
|
864
|
+
qtcore_Smoke->idClass("QMetaObject").index,
|
865
865
|
meta );
|
866
866
|
|
867
867
|
VALUE obj = set_obj_info("Qt::MetaObject", m);
|
@@ -880,9 +880,9 @@ cast_object_to(VALUE /*self*/, VALUE object, VALUE new_klass)
|
|
880
880
|
rb_raise(rb_eArgError, "unable to find class \"%s\" to cast to\n", StringValuePtr(new_klassname));
|
881
881
|
}
|
882
882
|
|
883
|
-
smokeruby_object * o_cast = alloc_smokeruby_object( o->allocated,
|
884
|
-
cast_to_id->smoke,
|
885
|
-
(int) cast_to_id->index,
|
883
|
+
smokeruby_object * o_cast = alloc_smokeruby_object( o->allocated,
|
884
|
+
cast_to_id->smoke,
|
885
|
+
(int) cast_to_id->index,
|
886
886
|
o->smoke->cast(o->ptr, o->classId, (int) cast_to_id->index) );
|
887
887
|
|
888
888
|
VALUE obj = Data_Wrap_Struct(new_klass, smokeruby_mark, smokeruby_free, (void *) o_cast);
|
@@ -915,9 +915,9 @@ qobject_qt_metacast(VALUE self, VALUE klass)
|
|
915
915
|
return Qnil;
|
916
916
|
}
|
917
917
|
|
918
|
-
smokeruby_object * o_cast = alloc_smokeruby_object( o->allocated,
|
919
|
-
mi->smoke,
|
920
|
-
(int) mi->index,
|
918
|
+
smokeruby_object * o_cast = alloc_smokeruby_object( o->allocated,
|
919
|
+
mi->smoke,
|
920
|
+
(int) mi->index,
|
921
921
|
ret );
|
922
922
|
|
923
923
|
VALUE obj = Data_Wrap_Struct(klass, smokeruby_mark, smokeruby_free, (void *) o_cast);
|
@@ -940,11 +940,11 @@ qsignalmapper_mapping(int argc, VALUE * argv, VALUE self)
|
|
940
940
|
i = -i; // turn into ambiguousMethodList index
|
941
941
|
while (meth.smoke->ambiguousMethodList[i] != 0) {
|
942
942
|
if ( ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name,
|
943
|
-
"QObject*" ) == 0
|
943
|
+
"QObject*" ) == 0
|
944
944
|
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QObject")
|
945
945
|
&& !Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") )
|
946
946
|
|| ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args]].name,
|
947
|
-
"QWidget*" ) == 0
|
947
|
+
"QWidget*" ) == 0
|
948
948
|
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") ) )
|
949
949
|
{
|
950
950
|
_current_method.smoke = meth.smoke;
|
@@ -976,11 +976,11 @@ qsignalmapper_set_mapping(int argc, VALUE * argv, VALUE self)
|
|
976
976
|
i = -i; // turn into ambiguousMethodList index
|
977
977
|
while (meth.smoke->ambiguousMethodList[i] != 0) {
|
978
978
|
if ( ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args + 1]].name,
|
979
|
-
"QObject*" ) == 0
|
979
|
+
"QObject*" ) == 0
|
980
980
|
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QObject")
|
981
981
|
&& !Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") )
|
982
982
|
|| ( qstrcmp( meth.smoke->types[meth.smoke->argumentList[meth.smoke->methods[meth.smoke->ambiguousMethodList[i]].args + 1]].name,
|
983
|
-
"QWidget*" ) == 0
|
983
|
+
"QWidget*" ) == 0
|
984
984
|
&& Smoke::isDerivedFrom(a->smoke->classes[a->classId].className, "QWidget") ) )
|
985
985
|
{
|
986
986
|
_current_method.smoke = meth.smoke;
|
@@ -1036,7 +1036,7 @@ qvariant_value(VALUE /*self*/, VALUE variant_value_klass, VALUE variant_value)
|
|
1036
1036
|
|
1037
1037
|
if (variant->userType() == rObject_typeId) {
|
1038
1038
|
return *(VALUE*) variant->data();
|
1039
|
-
#ifdef QT_QTDBUS
|
1039
|
+
#ifdef QT_QTDBUS
|
1040
1040
|
} else if (variant->userType() == qMetaTypeId<QDBusObjectPath>()) {
|
1041
1041
|
QString s = qVariantValue<QDBusObjectPath>(*variant).path();
|
1042
1042
|
return rb_str_new2(s.toLatin1());
|
@@ -1140,7 +1140,7 @@ qvariant_from_value(int argc, VALUE * argv, VALUE self)
|
|
1140
1140
|
if (argc == 2) {
|
1141
1141
|
Smoke::ModuleIndex nameId = Smoke::NullModuleIndex;
|
1142
1142
|
const char *typeName = StringValuePtr(argv[1]);
|
1143
|
-
|
1143
|
+
|
1144
1144
|
if (TYPE(argv[0]) == T_DATA) {
|
1145
1145
|
nameId = qtcore_Smoke->idMethodName("QVariant#");
|
1146
1146
|
} else if (TYPE(argv[0]) == T_ARRAY || qstrcmp(typeName, "long long") == 0 || qstrcmp(typeName, "unsigned long long") == 0) {
|
@@ -1233,7 +1233,7 @@ static Smoke::Index new_qvariant_qmap = 0;
|
|
1233
1233
|
QtRuby::MethodCall c(qtcore_Smoke, _current_method.index, self, argv, argc-1);
|
1234
1234
|
c.next();
|
1235
1235
|
return *(c.var());
|
1236
|
-
} else if ( argc == 1
|
1236
|
+
} else if ( argc == 1
|
1237
1237
|
&& TYPE(argv[0]) == T_ARRAY
|
1238
1238
|
&& RARRAY_LEN(argv[0]) > 0
|
1239
1239
|
&& TYPE(rb_ary_entry(argv[0], 0)) != T_STRING )
|
@@ -1282,7 +1282,7 @@ initialize_qt(int argc, VALUE * argv, VALUE self)
|
|
1282
1282
|
{
|
1283
1283
|
VALUE retval = Qnil;
|
1284
1284
|
VALUE temp_obj;
|
1285
|
-
|
1285
|
+
|
1286
1286
|
if (TYPE(self) == T_DATA) {
|
1287
1287
|
// If a ruby block was passed then run that now
|
1288
1288
|
if (rb_block_given_p()) {
|
@@ -1301,12 +1301,12 @@ initialize_qt(int argc, VALUE * argv, VALUE self)
|
|
1301
1301
|
temp_stack[1] = constructor_name;
|
1302
1302
|
temp_stack[2] = klass;
|
1303
1303
|
temp_stack[3] = self;
|
1304
|
-
|
1304
|
+
|
1305
1305
|
for (int count = 0; count < argc; count++) {
|
1306
1306
|
temp_stack[count+4] = argv[count];
|
1307
1307
|
}
|
1308
1308
|
|
1309
|
-
{
|
1309
|
+
{
|
1310
1310
|
QByteArray * mcid = find_cached_selector(argc+4, temp_stack, klass, rb_class2name(klass));
|
1311
1311
|
|
1312
1312
|
if (_current_method.index == -1) {
|
@@ -1322,7 +1322,7 @@ initialize_qt(int argc, VALUE * argv, VALUE self)
|
|
1322
1322
|
// Another longjmp here..
|
1323
1323
|
rb_raise(rb_eArgError, "unresolved constructor call %s\n", rb_class2name(klass));
|
1324
1324
|
}
|
1325
|
-
|
1325
|
+
|
1326
1326
|
{
|
1327
1327
|
// Allocate the MethodCall within a C block. Otherwise, because the continue_new_instance()
|
1328
1328
|
// call below will longjmp out, it wouldn't give C++ an opportunity to clean up
|
@@ -1330,13 +1330,13 @@ initialize_qt(int argc, VALUE * argv, VALUE self)
|
|
1330
1330
|
c.next();
|
1331
1331
|
temp_obj = *(c.var());
|
1332
1332
|
}
|
1333
|
-
|
1333
|
+
|
1334
1334
|
smokeruby_object * p = 0;
|
1335
1335
|
Data_Get_Struct(temp_obj, smokeruby_object, p);
|
1336
1336
|
|
1337
|
-
smokeruby_object * o = alloc_smokeruby_object( true,
|
1338
|
-
p->smoke,
|
1339
|
-
p->classId,
|
1337
|
+
smokeruby_object * o = alloc_smokeruby_object( true,
|
1338
|
+
p->smoke,
|
1339
|
+
p->classId,
|
1340
1340
|
p->ptr );
|
1341
1341
|
p->ptr = 0;
|
1342
1342
|
p->allocated = false;
|
@@ -1361,7 +1361,7 @@ new_qt(int argc, VALUE * argv, VALUE klass)
|
|
1361
1361
|
|
1362
1362
|
VALUE result = rb_funcall2(qt_internal_module, rb_intern("try_initialize"), argc+1, temp_stack);
|
1363
1363
|
rb_obj_call_init(result, argc, argv);
|
1364
|
-
|
1364
|
+
|
1365
1365
|
return result;
|
1366
1366
|
}
|
1367
1367
|
|
@@ -1375,7 +1375,7 @@ qapplication_argv(VALUE /*self*/)
|
|
1375
1375
|
for (int index = 1; index < qApp->argc(); index++) {
|
1376
1376
|
rb_ary_push(result, rb_str_new2(qApp->argv()[index]));
|
1377
1377
|
}
|
1378
|
-
|
1378
|
+
|
1379
1379
|
return result;
|
1380
1380
|
}
|
1381
1381
|
|
@@ -1439,8 +1439,8 @@ qt_metacall(int /*argc*/, VALUE * argv, VALUE self)
|
|
1439
1439
|
{
|
1440
1440
|
// Arguments: QMetaObject::Call _c, int id, void ** _o
|
1441
1441
|
QMetaObject::Call _c = (QMetaObject::Call) NUM2INT( rb_funcall( qt_internal_module,
|
1442
|
-
rb_intern("get_qinteger"),
|
1443
|
-
1,
|
1442
|
+
rb_intern("get_qinteger"),
|
1443
|
+
1,
|
1444
1444
|
argv[0] ) );
|
1445
1445
|
int id = NUM2INT(argv[1]);
|
1446
1446
|
void ** _o = 0;
|
@@ -1467,7 +1467,7 @@ qt_metacall(int /*argc*/, VALUE * argv, VALUE self)
|
|
1467
1467
|
}
|
1468
1468
|
} else {
|
1469
1469
|
// Should never happen..
|
1470
|
-
rb_raise(rb_eRuntimeError, "Cannot find %s::qt_metacall() method\n",
|
1470
|
+
rb_raise(rb_eRuntimeError, "Cannot find %s::qt_metacall() method\n",
|
1471
1471
|
o->smoke->classes[o->classId].className );
|
1472
1472
|
}
|
1473
1473
|
|
@@ -1506,7 +1506,7 @@ static QRegExp * rx = 0;
|
|
1506
1506
|
QtRuby::InvokeSlot slot(self, rb_intern(name.toLatin1()), mocArgs, _o);
|
1507
1507
|
slot.next();
|
1508
1508
|
}
|
1509
|
-
|
1509
|
+
|
1510
1510
|
return INT2NUM(id - count);
|
1511
1511
|
}
|
1512
1512
|
|
@@ -1586,7 +1586,7 @@ getIsa(VALUE /*self*/, VALUE classId)
|
|
1586
1586
|
return parents_list;
|
1587
1587
|
}
|
1588
1588
|
|
1589
|
-
// Return the class name of a QObject. Note that the name will be in the
|
1589
|
+
// Return the class name of a QObject. Note that the name will be in the
|
1590
1590
|
// form of Qt::Widget rather than QWidget. Is this a bug or a feature?
|
1591
1591
|
static VALUE
|
1592
1592
|
class_name(VALUE self)
|
@@ -1615,7 +1615,7 @@ inherits_qobject(int argc, VALUE * argv, VALUE /*self*/)
|
|
1615
1615
|
}
|
1616
1616
|
|
1617
1617
|
/* Adapted from the internal function qt_qFindChildren() in qobject.cpp */
|
1618
|
-
static void
|
1618
|
+
static void
|
1619
1619
|
rb_qFindChildren_helper(VALUE parent, const QString &name, VALUE re,
|
1620
1620
|
const QMetaObject &mo, VALUE list)
|
1621
1621
|
{
|
@@ -1627,7 +1627,7 @@ rb_qFindChildren_helper(VALUE parent, const QString &name, VALUE re,
|
|
1627
1627
|
rv = RARRAY_PTR(children)[i];
|
1628
1628
|
smokeruby_object *o = value_obj_info(rv);
|
1629
1629
|
QObject * obj = (QObject *) o->smoke->cast(o->ptr, o->classId, o->smoke->idClass("QObject").index);
|
1630
|
-
|
1630
|
+
|
1631
1631
|
// The original code had 'if (mo.cast(obj))' as a test, but it doesn't work here
|
1632
1632
|
if (obj->qt_metacast(mo.className()) != 0) {
|
1633
1633
|
if (re != Qnil) {
|
@@ -1665,7 +1665,7 @@ find_qobject_children(int argc, VALUE *argv, VALUE self)
|
|
1665
1665
|
re = argv[1];
|
1666
1666
|
}
|
1667
1667
|
}
|
1668
|
-
|
1668
|
+
|
1669
1669
|
VALUE metaObject = rb_funcall(argv[0], rb_intern("staticMetaObject"), 0);
|
1670
1670
|
smokeruby_object *o = value_obj_info(metaObject);
|
1671
1671
|
QMetaObject * mo = (QMetaObject*) o->ptr;
|
@@ -1708,7 +1708,7 @@ find_qobject_child(int argc, VALUE *argv, VALUE self)
|
|
1708
1708
|
if (argc == 2) {
|
1709
1709
|
name = QString::fromLatin1(StringValuePtr(argv[1]));
|
1710
1710
|
}
|
1711
|
-
|
1711
|
+
|
1712
1712
|
VALUE metaObject = rb_funcall(argv[0], rb_intern("staticMetaObject"), 0);
|
1713
1713
|
smokeruby_object *o = value_obj_info(metaObject);
|
1714
1714
|
QMetaObject * mo = (QMetaObject*) o->ptr;
|
@@ -1762,7 +1762,7 @@ isEnum(VALUE /*self*/, VALUE enumName_value)
|
|
1762
1762
|
break;
|
1763
1763
|
}
|
1764
1764
|
}
|
1765
|
-
return typeId > 0
|
1765
|
+
return typeId > 0
|
1766
1766
|
&& ( (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_enum
|
1767
1767
|
|| (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_ulong
|
1768
1768
|
|| (s->types[typeId].flags & Smoke::tf_elem) == Smoke::t_long
|
@@ -1794,12 +1794,16 @@ classid2name(VALUE /*self*/, VALUE mi_value)
|
|
1794
1794
|
static VALUE
|
1795
1795
|
find_pclassid(VALUE /*self*/, VALUE p_value)
|
1796
1796
|
{
|
1797
|
+
if (NIL_P(p_value)) {
|
1798
|
+
return rb_funcall(moduleindex_class, rb_intern("new"), 2, 0, 0);
|
1799
|
+
}
|
1800
|
+
|
1797
1801
|
char *p = StringValuePtr(p_value);
|
1798
1802
|
Smoke::ModuleIndex *r = classcache.value(QByteArray(p));
|
1799
1803
|
if (r != 0) {
|
1800
1804
|
return rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(r->smoke)), INT2NUM(r->index));
|
1801
1805
|
} else {
|
1802
|
-
return rb_funcall(moduleindex_class, rb_intern("new"), 2,
|
1806
|
+
return rb_funcall(moduleindex_class, rb_intern("new"), 2, Qnil, Qnil);
|
1803
1807
|
}
|
1804
1808
|
}
|
1805
1809
|
|
@@ -1809,8 +1813,8 @@ get_value_type(VALUE /*self*/, VALUE ruby_value)
|
|
1809
1813
|
return rb_str_new2(value_to_type_flag(ruby_value));
|
1810
1814
|
}
|
1811
1815
|
|
1812
|
-
static QMetaObject*
|
1813
|
-
parent_meta_object(VALUE obj)
|
1816
|
+
static QMetaObject*
|
1817
|
+
parent_meta_object(VALUE obj)
|
1814
1818
|
{
|
1815
1819
|
smokeruby_object* o = value_obj_info(obj);
|
1816
1820
|
Smoke::ModuleIndex nameId = o->smoke->idMethodName("metaObject");
|
@@ -1849,13 +1853,13 @@ make_metaObject(VALUE /*self*/, VALUE obj, VALUE parentMeta, VALUE stringdata_va
|
|
1849
1853
|
uint * data = new uint[count];
|
1850
1854
|
|
1851
1855
|
memcpy( (void *) stringdata, RSTRING_PTR(stringdata_value), RSTRING_LEN(stringdata_value) );
|
1852
|
-
|
1856
|
+
|
1853
1857
|
for (long i = 0; i < count; i++) {
|
1854
1858
|
VALUE rv = rb_ary_entry(data_value, i);
|
1855
1859
|
data[i] = NUM2UINT(rv);
|
1856
1860
|
}
|
1857
|
-
|
1858
|
-
QMetaObject ob = {
|
1861
|
+
|
1862
|
+
QMetaObject ob = {
|
1859
1863
|
{ superdata, stringdata, data, 0 }
|
1860
1864
|
} ;
|
1861
1865
|
|
@@ -1864,7 +1868,7 @@ make_metaObject(VALUE /*self*/, VALUE obj, VALUE parentMeta, VALUE stringdata_va
|
|
1864
1868
|
|
1865
1869
|
#ifdef DEBUG
|
1866
1870
|
printf("make_metaObject() superdata: %p %s\n", meta->d.superdata, superdata->className());
|
1867
|
-
|
1871
|
+
|
1868
1872
|
printf(
|
1869
1873
|
" // content:\n"
|
1870
1874
|
" %d, // revision\n"
|
@@ -1873,7 +1877,7 @@ make_metaObject(VALUE /*self*/, VALUE obj, VALUE parentMeta, VALUE stringdata_va
|
|
1873
1877
|
" %d, %d, // methods\n"
|
1874
1878
|
" %d, %d, // properties\n"
|
1875
1879
|
" %d, %d, // enums/sets\n",
|
1876
|
-
data[0], data[1], data[2], data[3],
|
1880
|
+
data[0], data[1], data[2], data[3],
|
1877
1881
|
data[4], data[5], data[6], data[7], data[8], data[9]);
|
1878
1882
|
|
1879
1883
|
int s = data[3];
|
@@ -1893,22 +1897,22 @@ make_metaObject(VALUE /*self*/, VALUE obj, VALUE parentMeta, VALUE stringdata_va
|
|
1893
1897
|
if (signal_headings && (data[s + (j * 5) + 4] & 0x04) != 0) {
|
1894
1898
|
printf("\n // signals: signature, parameters, type, tag, flags\n");
|
1895
1899
|
signal_headings = false;
|
1896
|
-
}
|
1900
|
+
}
|
1897
1901
|
|
1898
1902
|
if (slot_headings && (data[s + (j * 5) + 4] & 0x08) != 0) {
|
1899
1903
|
printf("\n // slots: signature, parameters, type, tag, flags\n");
|
1900
1904
|
slot_headings = false;
|
1901
1905
|
}
|
1902
1906
|
|
1903
|
-
printf(" %d, %d, %d, %d, 0x%2.2x\n",
|
1904
|
-
data[s + (j * 5)], data[s + (j * 5) + 1], data[s + (j * 5) + 2],
|
1907
|
+
printf(" %d, %d, %d, %d, 0x%2.2x\n",
|
1908
|
+
data[s + (j * 5)], data[s + (j * 5) + 1], data[s + (j * 5) + 2],
|
1905
1909
|
data[s + (j * 5) + 3], data[s + (j * 5) + 4]);
|
1906
1910
|
}
|
1907
1911
|
|
1908
1912
|
s += (data[4] * 5);
|
1909
1913
|
for (uint j = 0; j < data[6]; j++) {
|
1910
1914
|
printf("\n // properties: name, type, flags\n");
|
1911
|
-
printf(" %d, %d, 0x%8.8x\n",
|
1915
|
+
printf(" %d, %d, 0x%8.8x\n",
|
1912
1916
|
data[s + (j * 3)], data[s + (j * 3) + 1], data[s + (j * 3) + 2]);
|
1913
1917
|
}
|
1914
1918
|
|
@@ -1935,9 +1939,9 @@ make_metaObject(VALUE /*self*/, VALUE obj, VALUE parentMeta, VALUE stringdata_va
|
|
1935
1939
|
printf("\"\n\n");
|
1936
1940
|
|
1937
1941
|
#endif
|
1938
|
-
smokeruby_object * m = alloc_smokeruby_object( true,
|
1939
|
-
qtcore_Smoke,
|
1940
|
-
qtcore_Smoke->idClass("QMetaObject").index,
|
1942
|
+
smokeruby_object * m = alloc_smokeruby_object( true,
|
1943
|
+
qtcore_Smoke,
|
1944
|
+
qtcore_Smoke->idClass("QMetaObject").index,
|
1941
1945
|
meta );
|
1942
1946
|
|
1943
1947
|
return Data_Wrap_Struct(qmetaobject_class, smokeruby_mark, smokeruby_free, m);
|
@@ -1969,7 +1973,7 @@ dispose(VALUE self)
|
|
1969
1973
|
|
1970
1974
|
const char *className = o->smoke->classes[o->classId].className;
|
1971
1975
|
if(do_debug & qtdb_gc) printf("Deleting (%s*)%p\n", className, o->ptr);
|
1972
|
-
|
1976
|
+
|
1973
1977
|
unmapPointer(o, o->classId, 0);
|
1974
1978
|
object_count--;
|
1975
1979
|
|
@@ -1988,7 +1992,7 @@ dispose(VALUE self)
|
|
1988
1992
|
delete[] methodName;
|
1989
1993
|
o->ptr = 0;
|
1990
1994
|
o->allocated = false;
|
1991
|
-
|
1995
|
+
|
1992
1996
|
return Qnil;
|
1993
1997
|
}
|
1994
1998
|
|
@@ -2030,7 +2034,7 @@ findClass(VALUE /*self*/, VALUE name_value)
|
|
2030
2034
|
// char *name = StringValuePtr(name_value);
|
2031
2035
|
// return INT2NUM(qtcore_Smoke->idMethodName(name).index);
|
2032
2036
|
// }
|
2033
|
-
//
|
2037
|
+
//
|
2034
2038
|
// static VALUE
|
2035
2039
|
// idMethod(VALUE /*self*/, VALUE idclass_value, VALUE idmethodname_value)
|
2036
2040
|
// {
|
@@ -2140,14 +2144,14 @@ getClassList(VALUE /*self*/)
|
|
2140
2144
|
if (qtsvg_Smoke->classes[i].className && !qtsvg_Smoke->classes[i].external)
|
2141
2145
|
rb_ary_push(class_list, rb_str_new2(qtsvg_Smoke->classes[i].className));
|
2142
2146
|
}
|
2143
|
-
|
2147
|
+
|
2144
2148
|
#ifdef QT_QTDBUS
|
2145
2149
|
for (int i = 1; i <= qtdbus_Smoke->numClasses; i++) {
|
2146
2150
|
if (qtdbus_Smoke->classes[i].className && !qtdbus_Smoke->classes[i].external)
|
2147
2151
|
rb_ary_push(class_list, rb_str_new2(qtdbus_Smoke->classes[i].className));
|
2148
2152
|
}
|
2149
2153
|
#endif
|
2150
|
-
|
2154
|
+
|
2151
2155
|
return class_list;
|
2152
2156
|
}
|
2153
2157
|
|
@@ -2161,13 +2165,13 @@ create_qobject_class(VALUE /*self*/, VALUE package_value, VALUE module_value)
|
|
2161
2165
|
VALUE value_moduleName = rb_funcall(module_value, rb_intern("name"), 0);
|
2162
2166
|
const char *moduleName = strdup(StringValuePtr(value_moduleName));
|
2163
2167
|
VALUE klass = module_value;
|
2164
|
-
|
2168
|
+
|
2165
2169
|
QString packageName(package);
|
2166
2170
|
|
2167
2171
|
foreach(QString s, packageName.mid(strlen(moduleName) + 2).split("::")) {
|
2168
2172
|
klass = rb_define_class_under(klass, (const char*) s.toLatin1(), qt_base_class);
|
2169
2173
|
}
|
2170
|
-
|
2174
|
+
|
2171
2175
|
if (packageName == "Qt::Application" || packageName == "Qt::CoreApplication" ) {
|
2172
2176
|
rb_define_method(klass, "ARGV", (VALUE (*) (...)) qapplication_argv, 0);
|
2173
2177
|
} else if (packageName == "Qt::Object") {
|
@@ -2190,7 +2194,7 @@ create_qobject_class(VALUE /*self*/, VALUE package_value, VALUE module_value)
|
|
2190
2194
|
rb_define_method(qtablemodel_class, "remove_rows", (VALUE (*) (...)) qabstract_item_model_removerows, -1);
|
2191
2195
|
rb_define_method(qtablemodel_class, "removeColumns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
|
2192
2196
|
rb_define_method(qtablemodel_class, "remove_columns", (VALUE (*) (...)) qabstract_item_model_removecolumns, -1);
|
2193
|
-
|
2197
|
+
|
2194
2198
|
qlistmodel_class = rb_define_class_under(qt_module, "ListModel", klass);
|
2195
2199
|
rb_define_method(qlistmodel_class, "rowCount", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
|
2196
2200
|
rb_define_method(qlistmodel_class, "row_count", (VALUE (*) (...)) qabstract_item_model_rowcount, -1);
|
@@ -2216,7 +2220,7 @@ create_qobject_class(VALUE /*self*/, VALUE package_value, VALUE module_value)
|
|
2216
2220
|
rb_define_singleton_method(klass, "singleShot", (VALUE (*) (...)) qtimer_single_shot, -1);
|
2217
2221
|
rb_define_singleton_method(klass, "single_shot", (VALUE (*) (...)) qtimer_single_shot, -1);
|
2218
2222
|
}
|
2219
|
-
|
2223
|
+
|
2220
2224
|
|
2221
2225
|
rb_define_method(klass, "qobject_cast", (VALUE (*) (...)) qobject_qt_metacast, 1);
|
2222
2226
|
rb_define_method(klass, "inspect", (VALUE (*) (...)) inspect_qobject, 0);
|
@@ -2226,10 +2230,10 @@ create_qobject_class(VALUE /*self*/, VALUE package_value, VALUE module_value)
|
|
2226
2230
|
rb_define_method(klass, "inherits", (VALUE (*) (...)) inherits_qobject, -1);
|
2227
2231
|
rb_define_method(klass, "findChildren", (VALUE (*) (...)) find_qobject_children, -1);
|
2228
2232
|
rb_define_method(klass, "find_children", (VALUE (*) (...)) find_qobject_children, -1);
|
2229
|
-
rb_define_method(klass, "findChild", (VALUE (*) (...)) find_qobject_child, -1);
|
2230
|
-
rb_define_method(klass, "find_child", (VALUE (*) (...)) find_qobject_child, -1);
|
2231
|
-
rb_define_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
|
2232
|
-
rb_define_singleton_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
|
2233
|
+
rb_define_method(klass, "findChild", (VALUE (*) (...)) find_qobject_child, -1);
|
2234
|
+
rb_define_method(klass, "find_child", (VALUE (*) (...)) find_qobject_child, -1);
|
2235
|
+
rb_define_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
|
2236
|
+
rb_define_singleton_method(klass, "connect", (VALUE (*) (...)) qobject_connect, -1);
|
2233
2237
|
|
2234
2238
|
foreach(QtRubyModule m, qtruby_modules.values()) {
|
2235
2239
|
if (m.class_created)
|
@@ -2358,11 +2362,11 @@ Init_qtruby4()
|
|
2358
2362
|
init_qtopengl_Smoke();
|
2359
2363
|
init_qtnetwork_Smoke();
|
2360
2364
|
init_qtsvg_Smoke();
|
2361
|
-
#ifdef QT_QTDBUS
|
2365
|
+
#ifdef QT_QTDBUS
|
2362
2366
|
init_qtdbus_Smoke();
|
2363
2367
|
#endif
|
2364
2368
|
install_handlers(Qt_handlers);
|
2365
|
-
|
2369
|
+
|
2366
2370
|
INIT_BINDING(qtcore)
|
2367
2371
|
INIT_BINDING(qtgui)
|
2368
2372
|
INIT_BINDING(qtxml)
|
@@ -2370,7 +2374,7 @@ Init_qtruby4()
|
|
2370
2374
|
INIT_BINDING(qtopengl)
|
2371
2375
|
INIT_BINDING(qtnetwork)
|
2372
2376
|
INIT_BINDING(qtsvg)
|
2373
|
-
#ifdef QT_QTDBUS
|
2377
|
+
#ifdef QT_QTDBUS
|
2374
2378
|
INIT_BINDING(qtdbus)
|
2375
2379
|
#endif
|
2376
2380
|
|
@@ -2397,7 +2401,7 @@ Init_qtruby4()
|
|
2397
2401
|
|
2398
2402
|
rb_define_method(qt_base_class, "qVariantValue", (VALUE (*) (...)) qvariant_value, 2);
|
2399
2403
|
rb_define_method(qt_base_class, "qVariantFromValue", (VALUE (*) (...)) qvariant_from_value, -1);
|
2400
|
-
|
2404
|
+
|
2401
2405
|
rb_define_method(rb_cObject, "qDebug", (VALUE (*) (...)) qdebug, 1);
|
2402
2406
|
rb_define_method(rb_cObject, "qFatal", (VALUE (*) (...)) qfatal, 1);
|
2403
2407
|
rb_define_method(rb_cObject, "qWarning", (VALUE (*) (...)) qwarning, 1);
|
@@ -2439,9 +2443,9 @@ Init_qtruby4()
|
|
2439
2443
|
rb_define_module_function(qt_module, "dynamic_cast", (VALUE (*) (...)) cast_object_to, 2);
|
2440
2444
|
rb_define_module_function(qt_internal_module, "kross2smoke", (VALUE (*) (...)) kross2smoke, 2);
|
2441
2445
|
rb_define_module_function(qt_internal_module, "set_qtruby_embedded", (VALUE (*) (...)) set_qtruby_embedded_wrapped, 1);
|
2442
|
-
|
2446
|
+
|
2443
2447
|
rb_define_module_function(qt_internal_module, "application_terminated=", (VALUE (*) (...)) set_application_terminated, 1);
|
2444
|
-
|
2448
|
+
|
2445
2449
|
rb_define_module_function(qt_module, "version", (VALUE (*) (...)) version, 0);
|
2446
2450
|
rb_define_module_function(qt_module, "qtruby_version", (VALUE (*) (...)) qtruby_version, 0);
|
2447
2451
|
|
@@ -2450,9 +2454,9 @@ Init_qtruby4()
|
|
2450
2454
|
|
2451
2455
|
// A problem has been found with QtRuby when it is run with Ruby 1.9.1
|
2452
2456
|
// and GC.stess is true.
|
2453
|
-
// In the smokeruby_mark() function called during garbage collection,
|
2454
|
-
// any virtual methods which are called on the instances being checked
|
2455
|
-
// could have overriden by Ruby methods. So the Wt::Ruby runtime uses
|
2457
|
+
// In the smokeruby_mark() function called during garbage collection,
|
2458
|
+
// any virtual methods which are called on the instances being checked
|
2459
|
+
// could have overriden by Ruby methods. So the Wt::Ruby runtime uses
|
2456
2460
|
// 'respond_to()' to find out whether they have been overriden.
|
2457
2461
|
// However, this involves calling 'rb_intern()' on the method name,
|
2458
2462
|
// which means memory could be allocated, giving an error when running under
|