qtruby4 1.4.9-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/Qt3Support4.dll +0 -0
- data/bin/QtAssistantClient4.dll +0 -0
- data/bin/QtCore4.dll +0 -0
- data/bin/QtDBus4.dll +0 -0
- data/bin/QtDesigner4.dll +0 -0
- data/bin/QtDesignerComponents4.dll +0 -0
- data/bin/QtGui4.dll +0 -0
- data/bin/QtNetwork4.dll +0 -0
- data/bin/QtOpenGL4.dll +0 -0
- data/bin/QtScript4.dll +0 -0
- data/bin/QtSql4.dll +0 -0
- data/bin/QtSvg4.dll +0 -0
- data/bin/QtTest4.dll +0 -0
- data/bin/QtXml4.dll +0 -0
- data/bin/assistant.exe +0 -0
- data/bin/designer.exe +0 -0
- data/bin/libdbus-1.dll +0 -0
- data/bin/linguist.exe +0 -0
- data/bin/qdbus.exe +0 -0
- data/bin/qdbuscpp2xml.exe +0 -0
- data/bin/qdbusviewer.exe +0 -0
- data/bin/qdbusxml2cpp.exe +0 -0
- data/bin/rbqtapi +109 -0
- data/bin/rbqtsh +627 -0
- data/bin/rbrcc.exe +0 -0
- data/bin/rbuic4.exe +0 -0
- data/bin/smokeqt.dll +0 -0
- data/extconf.rb +9 -0
- data/lib/Makefile +5 -0
- data/lib/Qt.rb +1 -0
- data/lib/Qt3.rb +6 -0
- data/lib/Qt4.rb +6 -0
- data/lib/qt/qtruby4.rb +2734 -0
- data/lib/qtruby4.so +0 -0
- metadata +79 -0
data/bin/rbrcc.exe
ADDED
Binary file
|
data/bin/rbuic4.exe
ADDED
Binary file
|
data/bin/smokeqt.dll
ADDED
Binary file
|
data/extconf.rb
ADDED
data/lib/Qt.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'qtruby4'
|
data/lib/Qt3.rb
ADDED
data/lib/Qt4.rb
ADDED
data/lib/qt/qtruby4.rb
ADDED
@@ -0,0 +1,2734 @@
|
|
1
|
+
=begin
|
2
|
+
/***************************************************************************
|
3
|
+
qtruby.rb - description
|
4
|
+
-------------------
|
5
|
+
begin : Fri Jul 4 2003
|
6
|
+
copyright : (C) 2003-2005 by Richard Dale
|
7
|
+
email : Richard_Dale@tipitina.demon.co.uk
|
8
|
+
***************************************************************************/
|
9
|
+
|
10
|
+
/***************************************************************************
|
11
|
+
* *
|
12
|
+
* This program is free software; you can redistribute it and/or modify *
|
13
|
+
* it under the terms of the GNU General Public License as published by *
|
14
|
+
* the Free Software Foundation; either version 2 of the License, or *
|
15
|
+
* (at your option) any later version. *
|
16
|
+
* *
|
17
|
+
***************************************************************************/
|
18
|
+
=end
|
19
|
+
|
20
|
+
module Qt
|
21
|
+
module DebugLevel
|
22
|
+
Off, Minimal, High, Extensive = 0, 1, 2, 3
|
23
|
+
end
|
24
|
+
|
25
|
+
module QtDebugChannel
|
26
|
+
QTDB_NONE = 0x00
|
27
|
+
QTDB_AMBIGUOUS = 0x01
|
28
|
+
QTDB_METHOD_MISSING = 0x02
|
29
|
+
QTDB_CALLS = 0x04
|
30
|
+
QTDB_GC = 0x08
|
31
|
+
QTDB_VIRTUAL = 0x10
|
32
|
+
QTDB_VERBOSE = 0x20
|
33
|
+
QTDB_ALL = QTDB_VERBOSE | QTDB_VIRTUAL | QTDB_GC | QTDB_CALLS | QTDB_METHOD_MISSING | QTDB_AMBIGUOUS
|
34
|
+
end
|
35
|
+
|
36
|
+
@@debug_level = DebugLevel::Off
|
37
|
+
def Qt.debug_level=(level)
|
38
|
+
@@debug_level = level
|
39
|
+
Internal::setDebug Qt::QtDebugChannel::QTDB_ALL if level >= DebugLevel::Extensive
|
40
|
+
end
|
41
|
+
|
42
|
+
def Qt.debug_level
|
43
|
+
@@debug_level
|
44
|
+
end
|
45
|
+
|
46
|
+
class Base
|
47
|
+
def self.signals(*signal_list)
|
48
|
+
meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
|
49
|
+
meta.add_signals(signal_list)
|
50
|
+
meta.changed = true
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.slots(*slot_list)
|
54
|
+
meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
|
55
|
+
meta.add_slots(slot_list)
|
56
|
+
meta.changed = true
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.q_signal(signal)
|
60
|
+
meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
|
61
|
+
meta.add_signals([signal])
|
62
|
+
meta.changed = true
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.q_slot(slot)
|
66
|
+
meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
|
67
|
+
meta.add_slots([slot])
|
68
|
+
meta.changed = true
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.q_classinfo(key, value)
|
72
|
+
meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
|
73
|
+
meta.add_classinfo(key, value)
|
74
|
+
meta.changed = true
|
75
|
+
end
|
76
|
+
|
77
|
+
def **(a)
|
78
|
+
return Qt::**(self, a)
|
79
|
+
end
|
80
|
+
def +(a)
|
81
|
+
return Qt::+(self, a)
|
82
|
+
end
|
83
|
+
def ~(a)
|
84
|
+
return Qt::~(self, a)
|
85
|
+
end
|
86
|
+
def -@()
|
87
|
+
return Qt::-(self)
|
88
|
+
end
|
89
|
+
def -(a)
|
90
|
+
return Qt::-(self, a)
|
91
|
+
end
|
92
|
+
def *(a)
|
93
|
+
return Qt::*(self, a)
|
94
|
+
end
|
95
|
+
def /(a)
|
96
|
+
return Qt::/(self, a)
|
97
|
+
end
|
98
|
+
def %(a)
|
99
|
+
return Qt::%(self, a)
|
100
|
+
end
|
101
|
+
def >>(a)
|
102
|
+
return Qt::>>(self, a)
|
103
|
+
end
|
104
|
+
def <<(a)
|
105
|
+
return Qt::<<(self, a)
|
106
|
+
end
|
107
|
+
def &(a)
|
108
|
+
return Qt::&(self, a)
|
109
|
+
end
|
110
|
+
def ^(a)
|
111
|
+
return Qt::^(self, a)
|
112
|
+
end
|
113
|
+
def |(a)
|
114
|
+
return Qt::|(self, a)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Module has '<', '<=', '>' and '>=' operator instance methods, so pretend they
|
118
|
+
# don't exist by calling method_missing() explicitely
|
119
|
+
def <(a)
|
120
|
+
begin
|
121
|
+
Qt::method_missing(:<, self, a)
|
122
|
+
rescue
|
123
|
+
super(a)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def <=(a)
|
128
|
+
begin
|
129
|
+
Qt::method_missing(:<=, self, a)
|
130
|
+
rescue
|
131
|
+
super(a)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def >(a)
|
136
|
+
begin
|
137
|
+
Qt::method_missing(:>, self, a)
|
138
|
+
rescue
|
139
|
+
super(a)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def >=(a)
|
144
|
+
begin
|
145
|
+
Qt::method_missing(:>=, self, a)
|
146
|
+
rescue
|
147
|
+
super(a)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Object has a '==' operator instance method, so pretend it
|
152
|
+
# don't exist by calling method_missing() explicitely
|
153
|
+
def ==(a)
|
154
|
+
begin
|
155
|
+
Qt::method_missing(:==, self, a)
|
156
|
+
rescue
|
157
|
+
super(a)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
|
162
|
+
def methods(regular=true)
|
163
|
+
if !regular
|
164
|
+
return singleton_methods
|
165
|
+
end
|
166
|
+
|
167
|
+
qt_methods(super, 0x0)
|
168
|
+
end
|
169
|
+
|
170
|
+
def protected_methods
|
171
|
+
# From smoke.h, Smoke::mf_protected 0x80
|
172
|
+
qt_methods(super, 0x80)
|
173
|
+
end
|
174
|
+
|
175
|
+
def public_methods
|
176
|
+
methods
|
177
|
+
end
|
178
|
+
|
179
|
+
def singleton_methods
|
180
|
+
# From smoke.h, Smoke::mf_static 0x01
|
181
|
+
qt_methods(super, 0x01)
|
182
|
+
end
|
183
|
+
|
184
|
+
private
|
185
|
+
def qt_methods(meths, flags)
|
186
|
+
ids = []
|
187
|
+
# These methods are all defined in Qt::Base, even if they aren't supported by a particular
|
188
|
+
# subclass, so remove them to avoid confusion
|
189
|
+
meths -= ["%", "&", "*", "**", "+", "-", "-@", "/", "<", "<<", "<=", ">", ">=", ">>", "|", "~", "^"]
|
190
|
+
classid = Qt::Internal::idInstance(self)
|
191
|
+
Qt::Internal::getAllParents(classid, ids)
|
192
|
+
ids << classid
|
193
|
+
ids.each { |c| Qt::Internal::findAllMethodNames(meths, c, flags) }
|
194
|
+
return meths.uniq
|
195
|
+
end
|
196
|
+
end # Qt::Base
|
197
|
+
|
198
|
+
class AbstractSocket < Qt::Base
|
199
|
+
def abort(*args)
|
200
|
+
method_missing(:abort, *args)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
class AbstractTextDocumentLayout < Qt::Base
|
205
|
+
def format(*args)
|
206
|
+
method_missing(:format, *args)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
class AccessibleEvent < Qt::Base
|
211
|
+
def type(*args)
|
212
|
+
method_missing(:type, *args)
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
class ActionEvent < Qt::Base
|
217
|
+
def type(*args)
|
218
|
+
method_missing(:type, *args)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
class Action < Qt::Base
|
223
|
+
def setShortcut(arg)
|
224
|
+
if arg.kind_of?(String)
|
225
|
+
return super(Qt::KeySequence.new(arg))
|
226
|
+
else
|
227
|
+
return super(arg)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def shortcut=(arg)
|
232
|
+
setShortcut(arg)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
class Application < Qt::Base
|
237
|
+
# Delete the underlying C++ instance after exec returns
|
238
|
+
# Otherwise, rb_gc_call_finalizer_at_exit() can delete
|
239
|
+
# stuff that Qt::Application still needs for its cleanup.
|
240
|
+
def exec
|
241
|
+
method_missing(:exec)
|
242
|
+
self.dispose
|
243
|
+
Qt::Internal.application_terminated = true
|
244
|
+
end
|
245
|
+
|
246
|
+
def type(*args)
|
247
|
+
method_missing(:type, *args)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
class Buffer < Qt::Base
|
252
|
+
def open(*args)
|
253
|
+
method_missing(:open, *args)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
class ButtonGroup < Qt::Base
|
258
|
+
def id(*args)
|
259
|
+
method_missing(:id, *args)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
class ByteArray < Qt::Base
|
264
|
+
def to_s
|
265
|
+
return constData()
|
266
|
+
end
|
267
|
+
|
268
|
+
def to_i
|
269
|
+
return toInt()
|
270
|
+
end
|
271
|
+
|
272
|
+
def to_f
|
273
|
+
return toDouble()
|
274
|
+
end
|
275
|
+
|
276
|
+
def chop(*args)
|
277
|
+
method_missing(:chop, *args)
|
278
|
+
end
|
279
|
+
|
280
|
+
def split(*args)
|
281
|
+
method_missing(:split, *args)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
class CheckBox < Qt::Base
|
286
|
+
def setShortcut(arg)
|
287
|
+
if arg.kind_of?(String)
|
288
|
+
return super(Qt::KeySequence.new(arg))
|
289
|
+
else
|
290
|
+
return super(arg)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
def shortcut=(arg)
|
295
|
+
setShortcut(arg)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
class ChildEvent < Qt::Base
|
300
|
+
def type(*args)
|
301
|
+
method_missing(:type, *args)
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
class CloseEvent < Qt::Base
|
306
|
+
def type(*args)
|
307
|
+
method_missing(:type, *args)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
class Color < Qt::Base
|
312
|
+
def inspect
|
313
|
+
str = super
|
314
|
+
str.sub(/>$/, " %s>" % name)
|
315
|
+
end
|
316
|
+
|
317
|
+
def pretty_print(pp)
|
318
|
+
str = to_s
|
319
|
+
pp.text str.sub(/>$/, " %s>" % name)
|
320
|
+
end
|
321
|
+
|
322
|
+
def name(*args)
|
323
|
+
method_missing(:name, *args)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
class Connection < Qt::Base
|
328
|
+
def inspect
|
329
|
+
str = super
|
330
|
+
str.sub(/>$/, " memberName=%s, memberType=%s, object=%s>" %
|
331
|
+
[memberName.inspect, memberType == 1 ? "SLOT" : "SIGNAL", object.inspect] )
|
332
|
+
end
|
333
|
+
|
334
|
+
def pretty_print(pp)
|
335
|
+
str = to_s
|
336
|
+
pp.text str.sub(/>$/, "\n memberName=%s,\n memberType=%s,\n object=%s>" %
|
337
|
+
[memberName.inspect, memberType == 1 ? "SLOT" : "SIGNAL", object.inspect] )
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
class ContextMenuEvent < Qt::Base
|
342
|
+
def type(*args)
|
343
|
+
method_missing(:type, *args)
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
class CoreApplication < Qt::Base
|
348
|
+
def exec
|
349
|
+
method_missing(:exec)
|
350
|
+
self.dispose
|
351
|
+
Qt::Internal.application_terminated = true
|
352
|
+
end
|
353
|
+
|
354
|
+
def exit(*args)
|
355
|
+
method_missing(:exit, *args)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
class Cursor < Qt::Base
|
360
|
+
def inspect
|
361
|
+
str = super
|
362
|
+
str.sub(/>$/, " shape=%d>" % shape)
|
363
|
+
end
|
364
|
+
|
365
|
+
def pretty_print(pp)
|
366
|
+
str = to_s
|
367
|
+
pp.text str.sub(/>$/, " shape=%d>" % shape)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
class CustomEvent < Qt::Base
|
372
|
+
def type(*args)
|
373
|
+
method_missing(:type, *args)
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
class Date < Qt::Base
|
378
|
+
|
379
|
+
def initialize(*args)
|
380
|
+
if args.size == 1 && args[0].class.name == "Date"
|
381
|
+
return super(args[0].year, args[0].month, args[0].day)
|
382
|
+
else
|
383
|
+
return super(*args)
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
def inspect
|
388
|
+
str = super
|
389
|
+
str.sub(/>$/, " %s>" % toString)
|
390
|
+
end
|
391
|
+
|
392
|
+
def pretty_print(pp)
|
393
|
+
str = to_s
|
394
|
+
pp.text str.sub(/>$/, " %s>" % toString)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
class DateTime < Qt::Base
|
399
|
+
def initialize(*args)
|
400
|
+
if args.size == 1 && args[0].class.name == "DateTime"
|
401
|
+
return super( Qt::Date.new(args[0].year, args[0].month, args[0].day),
|
402
|
+
Qt::Time.new(args[0].hour, args[0].min, args[0].sec) )
|
403
|
+
else
|
404
|
+
return super(*args)
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
def inspect
|
409
|
+
str = super
|
410
|
+
str.sub(/>$/, " %s>" % toString)
|
411
|
+
end
|
412
|
+
|
413
|
+
def pretty_print(pp)
|
414
|
+
str = to_s
|
415
|
+
pp.text str.sub(/>$/, " %s>" % toString)
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
419
|
+
class DBusConnection < Qt::Base
|
420
|
+
def send(*args)
|
421
|
+
method_missing(:send, *args)
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
class DBusConnectionInterface < Qt::Base
|
426
|
+
def serviceOwner(name)
|
427
|
+
return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "GetNameOwner", [Qt::Variant.new(name)]))
|
428
|
+
end
|
429
|
+
|
430
|
+
def registeredServiceNames
|
431
|
+
return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "ListNames"))
|
432
|
+
end
|
433
|
+
|
434
|
+
def isServiceRegistered(serviceName)
|
435
|
+
return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "NameHasOwner", [Qt::Variant.new(serviceName)]))
|
436
|
+
end
|
437
|
+
|
438
|
+
def serviceRegistered?(serviceName)
|
439
|
+
return isServiceRegistered(serviceName)
|
440
|
+
end
|
441
|
+
|
442
|
+
def servicePid(serviceName)
|
443
|
+
return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "GetConnectionUnixProcessID", [Qt::Variant.new(serviceName)]))
|
444
|
+
end
|
445
|
+
|
446
|
+
def serviceUid(serviceName)
|
447
|
+
return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "GetConnectionUnixUser", [Qt::Variant.new(serviceName)]))
|
448
|
+
end
|
449
|
+
|
450
|
+
def startService(name)
|
451
|
+
return call("StartServiceByName", Qt::Variant.new(name), Qt::Variant.new(0)).value
|
452
|
+
end
|
453
|
+
end
|
454
|
+
|
455
|
+
class DBusError < Qt::Base
|
456
|
+
def type(*args)
|
457
|
+
method_missing(:type, *args)
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
class DBusInterface < Qt::Base
|
462
|
+
|
463
|
+
def call(method_name, *args)
|
464
|
+
if args.length == 0
|
465
|
+
return super(method_name)
|
466
|
+
else
|
467
|
+
# If the method is Qt::DBusInterface.call(), create an Array
|
468
|
+
# 'dbusArgs' of Qt::Variants from '*args'
|
469
|
+
qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
|
470
|
+
return super(method_name, *qdbusArgs)
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
def method_missing(id, *args)
|
475
|
+
begin
|
476
|
+
# First look for a method in the Smoke runtime
|
477
|
+
# If not found, then throw an exception and try dbus.
|
478
|
+
super(id, *args)
|
479
|
+
rescue
|
480
|
+
if args.length == 0
|
481
|
+
return call(id.to_s).value
|
482
|
+
else
|
483
|
+
return call(id.to_s, *args).value
|
484
|
+
end
|
485
|
+
end
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
class DBusMessage < Qt::Base
|
490
|
+
def type(*args)
|
491
|
+
method_missing(:type, *args)
|
492
|
+
end
|
493
|
+
|
494
|
+
def value
|
495
|
+
if type() == Qt::DBusMessage::ReplyMessage
|
496
|
+
reply = arguments()
|
497
|
+
return reply.length > 0 ? reply[0].value : nil
|
498
|
+
else
|
499
|
+
return nil
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
def <<(a)
|
504
|
+
if a.kind_of?(Qt::Variant)
|
505
|
+
return super(a)
|
506
|
+
else
|
507
|
+
return super(qVariantFromValue(a))
|
508
|
+
end
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
512
|
+
class DBusReply
|
513
|
+
def initialize(reply)
|
514
|
+
@error = Qt::DBusError.new(reply)
|
515
|
+
|
516
|
+
if @error.valid?
|
517
|
+
@data = Qt::Variant.new
|
518
|
+
return
|
519
|
+
end
|
520
|
+
|
521
|
+
if reply.arguments.length >= 1
|
522
|
+
@data = reply.arguments[0]
|
523
|
+
return
|
524
|
+
end
|
525
|
+
|
526
|
+
# error
|
527
|
+
@error = Qt::DBusError.new( Qt::DBusError::InvalidSignature,
|
528
|
+
"Unexpected reply signature" )
|
529
|
+
@data = Qt::Variant.new # clear it
|
530
|
+
end
|
531
|
+
|
532
|
+
def isValid
|
533
|
+
return !@error.isValid
|
534
|
+
end
|
535
|
+
|
536
|
+
def valid?
|
537
|
+
return !@error.isValid
|
538
|
+
end
|
539
|
+
|
540
|
+
def value
|
541
|
+
return @data.value
|
542
|
+
end
|
543
|
+
|
544
|
+
def error
|
545
|
+
return @error
|
546
|
+
end
|
547
|
+
end
|
548
|
+
|
549
|
+
class Dialog < Qt::Base
|
550
|
+
def exec(*args)
|
551
|
+
method_missing(:exec, *args)
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
class DomAttr < Qt::Base
|
556
|
+
def name(*args)
|
557
|
+
method_missing(:name, *args)
|
558
|
+
end
|
559
|
+
end
|
560
|
+
|
561
|
+
class DomDocumentType < Qt::Base
|
562
|
+
def name(*args)
|
563
|
+
method_missing(:name, *args)
|
564
|
+
end
|
565
|
+
|
566
|
+
def type(*args)
|
567
|
+
method_missing(:type, *args)
|
568
|
+
end
|
569
|
+
end
|
570
|
+
|
571
|
+
class DragEnterEvent < Qt::Base
|
572
|
+
def type(*args)
|
573
|
+
method_missing(:type, *args)
|
574
|
+
end
|
575
|
+
end
|
576
|
+
|
577
|
+
class DragLeaveEvent < Qt::Base
|
578
|
+
def type(*args)
|
579
|
+
method_missing(:type, *args)
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
class DropEvent < Qt::Base
|
584
|
+
def format(*args)
|
585
|
+
method_missing(:format, *args)
|
586
|
+
end
|
587
|
+
def type(*args)
|
588
|
+
method_missing(:type, *args)
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
class Event < Qt::Base
|
593
|
+
def type(*args)
|
594
|
+
method_missing(:type, *args)
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
598
|
+
class EventLoop < Qt::Base
|
599
|
+
def exec(*args)
|
600
|
+
method_missing(:exec, *args)
|
601
|
+
end
|
602
|
+
|
603
|
+
def exit(*args)
|
604
|
+
method_missing(:exit, *args)
|
605
|
+
end
|
606
|
+
end
|
607
|
+
|
608
|
+
class File < Qt::Base
|
609
|
+
def open(*args)
|
610
|
+
method_missing(:open, *args)
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
class FileOpenEvent < Qt::Base
|
615
|
+
def type(*args)
|
616
|
+
method_missing(:type, *args)
|
617
|
+
end
|
618
|
+
end
|
619
|
+
|
620
|
+
class FileIconProvider < Qt::Base
|
621
|
+
def type(*args)
|
622
|
+
method_missing(:type, *args)
|
623
|
+
end
|
624
|
+
end
|
625
|
+
|
626
|
+
class FocusEvent < Qt::Base
|
627
|
+
def type(*args)
|
628
|
+
method_missing(:type, *args)
|
629
|
+
end
|
630
|
+
end
|
631
|
+
|
632
|
+
class Font < Qt::Base
|
633
|
+
def inspect
|
634
|
+
str = super
|
635
|
+
str.sub(/>$/, " family=%s, pointSize=%d, weight=%d, italic=%s, bold=%s, underline=%s, strikeOut=%s>" %
|
636
|
+
[family.inspect, pointSize, weight, italic, bold, underline, strikeOut])
|
637
|
+
end
|
638
|
+
|
639
|
+
def pretty_print(pp)
|
640
|
+
str = to_s
|
641
|
+
pp.text str.sub(/>$/, "\n family=%s,\n pointSize=%d,\n weight=%d,\n italic=%s,\n bold=%s,\n underline=%s,\n strikeOut=%s>" %
|
642
|
+
[family.inspect, pointSize, weight, italic, bold, underline, strikeOut])
|
643
|
+
end
|
644
|
+
end
|
645
|
+
|
646
|
+
class Ftp < Qt::Base
|
647
|
+
def abort(*args)
|
648
|
+
method_missing(:abort, *args)
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
class GLContext < Qt::Base
|
653
|
+
def format(*args)
|
654
|
+
method_missing(:format, *args)
|
655
|
+
end
|
656
|
+
end
|
657
|
+
|
658
|
+
class GLPixelBuffer < Qt::Base
|
659
|
+
def format(*args)
|
660
|
+
method_missing(:format, *args)
|
661
|
+
end
|
662
|
+
end
|
663
|
+
|
664
|
+
class GLWidget < Qt::Base
|
665
|
+
def format(*args)
|
666
|
+
method_missing(:format, *args)
|
667
|
+
end
|
668
|
+
end
|
669
|
+
|
670
|
+
class GenericArgument < Qt::Base
|
671
|
+
def name(*args)
|
672
|
+
method_missing(:name, *args)
|
673
|
+
end
|
674
|
+
end
|
675
|
+
|
676
|
+
class Gradient < Qt::Base
|
677
|
+
def type(*args)
|
678
|
+
method_missing(:type, *args)
|
679
|
+
end
|
680
|
+
end
|
681
|
+
|
682
|
+
class GraphicsEllipseItem < Qt::Base
|
683
|
+
def type(*args)
|
684
|
+
method_missing(:type, *args)
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|
688
|
+
class GraphicsItem < Qt::Base
|
689
|
+
def type(*args)
|
690
|
+
method_missing(:type, *args)
|
691
|
+
end
|
692
|
+
end
|
693
|
+
|
694
|
+
class GraphicsItemGroup < Qt::Base
|
695
|
+
def type(*args)
|
696
|
+
method_missing(:type, *args)
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
class GraphicsLineItem < Qt::Base
|
701
|
+
def type(*args)
|
702
|
+
method_missing(:type, *args)
|
703
|
+
end
|
704
|
+
end
|
705
|
+
|
706
|
+
class GraphicsPathItem < Qt::Base
|
707
|
+
def type(*args)
|
708
|
+
method_missing(:type, *args)
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
class GraphicsPixmapItem < Qt::Base
|
713
|
+
def type(*args)
|
714
|
+
method_missing(:type, *args)
|
715
|
+
end
|
716
|
+
end
|
717
|
+
|
718
|
+
class GraphicsPolygonItem < Qt::Base
|
719
|
+
def type(*args)
|
720
|
+
method_missing(:type, *args)
|
721
|
+
end
|
722
|
+
end
|
723
|
+
|
724
|
+
class GraphicsRectItem < Qt::Base
|
725
|
+
def type(*args)
|
726
|
+
method_missing(:type, *args)
|
727
|
+
end
|
728
|
+
end
|
729
|
+
|
730
|
+
class GraphicsSceneMouseEvent < Qt::Base
|
731
|
+
def type(*args)
|
732
|
+
method_missing(:type, *args)
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
736
|
+
class GraphicsSceneContextMenuEvent < Qt::Base
|
737
|
+
def type(*args)
|
738
|
+
method_missing(:type, *args)
|
739
|
+
end
|
740
|
+
end
|
741
|
+
|
742
|
+
class GraphicsSceneHoverEvent < Qt::Base
|
743
|
+
def type(*args)
|
744
|
+
method_missing(:type, *args)
|
745
|
+
end
|
746
|
+
end
|
747
|
+
|
748
|
+
class GraphicsSceneHelpEvent < Qt::Base
|
749
|
+
def type(*args)
|
750
|
+
method_missing(:type, *args)
|
751
|
+
end
|
752
|
+
end
|
753
|
+
|
754
|
+
class GraphicsSceneWheelEvent < Qt::Base
|
755
|
+
def type(*args)
|
756
|
+
method_missing(:type, *args)
|
757
|
+
end
|
758
|
+
end
|
759
|
+
|
760
|
+
class GraphicsSimpleTextItem < Qt::Base
|
761
|
+
def type(*args)
|
762
|
+
method_missing(:type, *args)
|
763
|
+
end
|
764
|
+
end
|
765
|
+
|
766
|
+
class GraphicsTextItem < Qt::Base
|
767
|
+
def type(*args)
|
768
|
+
method_missing(:type, *args)
|
769
|
+
end
|
770
|
+
end
|
771
|
+
|
772
|
+
class HelpEvent < Qt::Base
|
773
|
+
def type(*args)
|
774
|
+
method_missing(:type, *args)
|
775
|
+
end
|
776
|
+
end
|
777
|
+
|
778
|
+
class HideEvent < Qt::Base
|
779
|
+
def type(*args)
|
780
|
+
method_missing(:type, *args)
|
781
|
+
end
|
782
|
+
end
|
783
|
+
|
784
|
+
class HoverEvent < Qt::Base
|
785
|
+
def type(*args)
|
786
|
+
method_missing(:type, *args)
|
787
|
+
end
|
788
|
+
end
|
789
|
+
|
790
|
+
class Http < Qt::Base
|
791
|
+
def abort(*args)
|
792
|
+
method_missing(:abort, *args)
|
793
|
+
end
|
794
|
+
end
|
795
|
+
|
796
|
+
class HttpRequestHeader < Qt::Base
|
797
|
+
def method(*args)
|
798
|
+
if args.length == 1
|
799
|
+
super(*args)
|
800
|
+
else
|
801
|
+
method_missing(:method, *args)
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|
805
|
+
|
806
|
+
class IconDragEvent < Qt::Base
|
807
|
+
def type(*args)
|
808
|
+
method_missing(:type, *args)
|
809
|
+
end
|
810
|
+
end
|
811
|
+
|
812
|
+
class InputEvent < Qt::Base
|
813
|
+
def type(*args)
|
814
|
+
method_missing(:type, *args)
|
815
|
+
end
|
816
|
+
end
|
817
|
+
|
818
|
+
class InputMethodEvent < Qt::Base
|
819
|
+
def type(*args)
|
820
|
+
method_missing(:type, *args)
|
821
|
+
end
|
822
|
+
end
|
823
|
+
|
824
|
+
class IODevice < Qt::Base
|
825
|
+
def open(*args)
|
826
|
+
method_missing(:open, *args)
|
827
|
+
end
|
828
|
+
end
|
829
|
+
|
830
|
+
class Image < Qt::Base
|
831
|
+
def fromImage(image)
|
832
|
+
send("operator=".to_sym, image)
|
833
|
+
end
|
834
|
+
|
835
|
+
def format(*args)
|
836
|
+
method_missing(:format, *args)
|
837
|
+
end
|
838
|
+
|
839
|
+
def load(*args)
|
840
|
+
method_missing(:load, *args)
|
841
|
+
end
|
842
|
+
end
|
843
|
+
|
844
|
+
class ImageIOHandler < Qt::Base
|
845
|
+
def format(*args)
|
846
|
+
method_missing(:format, *args)
|
847
|
+
end
|
848
|
+
|
849
|
+
def name(*args)
|
850
|
+
method_missing(:name, *args)
|
851
|
+
end
|
852
|
+
end
|
853
|
+
|
854
|
+
class ImageReader < Qt::Base
|
855
|
+
def format(*args)
|
856
|
+
method_missing(:format, *args)
|
857
|
+
end
|
858
|
+
end
|
859
|
+
|
860
|
+
class ImageWriter < Qt::Base
|
861
|
+
def format(*args)
|
862
|
+
method_missing(:format, *args)
|
863
|
+
end
|
864
|
+
end
|
865
|
+
|
866
|
+
class ItemSelection < Qt::Base
|
867
|
+
def select(*args)
|
868
|
+
method_missing(:select, *args)
|
869
|
+
end
|
870
|
+
|
871
|
+
def split(*args)
|
872
|
+
method_missing(:split, *args)
|
873
|
+
end
|
874
|
+
end
|
875
|
+
|
876
|
+
class ItemSelectionModel < Qt::Base
|
877
|
+
def select(*args)
|
878
|
+
method_missing(:select, *args)
|
879
|
+
end
|
880
|
+
end
|
881
|
+
|
882
|
+
class KeySequence < Qt::Base
|
883
|
+
def initialize(*args)
|
884
|
+
if args.length == 1 && args[0].kind_of?(Qt::Enum) && args[0].type == "Qt::Key"
|
885
|
+
return super(args[0].to_i)
|
886
|
+
end
|
887
|
+
return super(*args)
|
888
|
+
end
|
889
|
+
end
|
890
|
+
|
891
|
+
class LCDNumber < Qt::Base
|
892
|
+
def display(item)
|
893
|
+
method_missing(:display, item)
|
894
|
+
end
|
895
|
+
end
|
896
|
+
|
897
|
+
class Library < Qt::Base
|
898
|
+
def load(*args)
|
899
|
+
method_missing(:load, *args)
|
900
|
+
end
|
901
|
+
end
|
902
|
+
|
903
|
+
class ListWidgetItem < Qt::Base
|
904
|
+
def clone(*args)
|
905
|
+
method_missing(:clone, *args)
|
906
|
+
end
|
907
|
+
|
908
|
+
def type(*args)
|
909
|
+
method_missing(:type, *args)
|
910
|
+
end
|
911
|
+
|
912
|
+
def inspect
|
913
|
+
str = super
|
914
|
+
str.sub(/>$/, " text=%s>" % text)
|
915
|
+
end
|
916
|
+
|
917
|
+
def pretty_print(pp)
|
918
|
+
str = to_s
|
919
|
+
pp.text str.sub(/>$/, " text=%s>" % text)
|
920
|
+
end
|
921
|
+
end
|
922
|
+
|
923
|
+
class Locale < Qt::Base
|
924
|
+
def name(*args)
|
925
|
+
method_missing(:name, *args)
|
926
|
+
end
|
927
|
+
|
928
|
+
def system(*args)
|
929
|
+
method_missing(:system, *args)
|
930
|
+
end
|
931
|
+
end
|
932
|
+
|
933
|
+
class Menu < Qt::Base
|
934
|
+
def exec(*args)
|
935
|
+
method_missing(:exec, *args)
|
936
|
+
end
|
937
|
+
end
|
938
|
+
|
939
|
+
class MetaClassInfo < Qt::Base
|
940
|
+
def name(*args)
|
941
|
+
method_missing(:name, *args)
|
942
|
+
end
|
943
|
+
end
|
944
|
+
|
945
|
+
class MetaEnum < Qt::Base
|
946
|
+
def name(*args)
|
947
|
+
method_missing(:name, *args)
|
948
|
+
end
|
949
|
+
|
950
|
+
def keyValues()
|
951
|
+
res = []
|
952
|
+
for i in 0...keyCount()
|
953
|
+
if flag?
|
954
|
+
res.push "%s=0x%x" % [key(i), value(i)]
|
955
|
+
else
|
956
|
+
res.push "%s=%d" % [key(i), value(i)]
|
957
|
+
end
|
958
|
+
end
|
959
|
+
return res
|
960
|
+
end
|
961
|
+
|
962
|
+
def inspect
|
963
|
+
str = super
|
964
|
+
str.sub(/>$/, " scope=%s, name=%s, keyValues=Array (%d element(s))>" % [scope, name, keyValues.length])
|
965
|
+
end
|
966
|
+
|
967
|
+
def pretty_print(pp)
|
968
|
+
str = to_s
|
969
|
+
pp.text str.sub(/>$/, " scope=%s, name=%s, keyValues=Array (%d element(s))>" % [scope, name, keyValues.length])
|
970
|
+
end
|
971
|
+
end
|
972
|
+
|
973
|
+
class MetaMethod < Qt::Base
|
974
|
+
# Oops, name clash with the Signal module so hard code
|
975
|
+
# this value rather than get it from the Smoke runtime
|
976
|
+
Signal = 1
|
977
|
+
end
|
978
|
+
|
979
|
+
class MetaObject < Qt::Base
|
980
|
+
def method(*args)
|
981
|
+
if args.length == 1 && args[0].kind_of?(Symbol)
|
982
|
+
super(*args)
|
983
|
+
else
|
984
|
+
method_missing(:method, *args)
|
985
|
+
end
|
986
|
+
end
|
987
|
+
|
988
|
+
# Add three methods, 'propertyNames()', 'slotNames()' and 'signalNames()'
|
989
|
+
# from Qt3, as they are very useful when debugging
|
990
|
+
|
991
|
+
def propertyNames(inherits = false)
|
992
|
+
res = []
|
993
|
+
if inherits
|
994
|
+
for p in 0...propertyCount()
|
995
|
+
res.push property(p).name
|
996
|
+
end
|
997
|
+
else
|
998
|
+
for p in propertyOffset()...propertyCount()
|
999
|
+
res.push property(p).name
|
1000
|
+
end
|
1001
|
+
end
|
1002
|
+
return res
|
1003
|
+
end
|
1004
|
+
|
1005
|
+
def slotNames(inherits = false)
|
1006
|
+
res = []
|
1007
|
+
if inherits
|
1008
|
+
for m in 0...methodCount()
|
1009
|
+
if method(m).methodType == Qt::MetaMethod::Slot
|
1010
|
+
res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
|
1011
|
+
method(m).signature]
|
1012
|
+
end
|
1013
|
+
end
|
1014
|
+
else
|
1015
|
+
for m in methodOffset()...methodCount()
|
1016
|
+
if method(m).methodType == Qt::MetaMethod::Slot
|
1017
|
+
res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
|
1018
|
+
method(m).signature]
|
1019
|
+
end
|
1020
|
+
end
|
1021
|
+
end
|
1022
|
+
return res
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
def signalNames(inherits = false)
|
1026
|
+
res = []
|
1027
|
+
if inherits
|
1028
|
+
for m in 0...methodCount()
|
1029
|
+
if method(m).methodType == Qt::MetaMethod::Signal
|
1030
|
+
res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
|
1031
|
+
method(m).signature]
|
1032
|
+
end
|
1033
|
+
end
|
1034
|
+
else
|
1035
|
+
for m in methodOffset()...methodCount()
|
1036
|
+
if method(m).methodType == Qt::MetaMethod::Signal
|
1037
|
+
res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
|
1038
|
+
method(m).signature]
|
1039
|
+
end
|
1040
|
+
end
|
1041
|
+
end
|
1042
|
+
return res
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
def enumerators(inherits = false)
|
1046
|
+
res = []
|
1047
|
+
if inherits
|
1048
|
+
for e in 0...enumeratorCount()
|
1049
|
+
res.push enumerator(e)
|
1050
|
+
end
|
1051
|
+
else
|
1052
|
+
for e in enumeratorOffset()...enumeratorCount()
|
1053
|
+
res.push enumerator(e)
|
1054
|
+
end
|
1055
|
+
end
|
1056
|
+
return res
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
def inspect
|
1060
|
+
str = super
|
1061
|
+
str.sub!(/>$/, "")
|
1062
|
+
str << " className=%s," % className
|
1063
|
+
str << " propertyNames=Array (%d element(s))," % propertyNames.length unless propertyNames.length == 0
|
1064
|
+
str << " signalNames=Array (%d element(s))," % signalNames.length unless signalNames.length == 0
|
1065
|
+
str << " slotNames=Array (%d element(s))," % slotNames.length unless slotNames.length == 0
|
1066
|
+
str << " enumerators=Array (%d element(s))," % enumerators.length unless enumerators.length == 0
|
1067
|
+
str << " superClass=%s," % superClass.inspect unless superClass == nil
|
1068
|
+
str.chop!
|
1069
|
+
str << ">"
|
1070
|
+
end
|
1071
|
+
|
1072
|
+
def pretty_print(pp)
|
1073
|
+
str = to_s
|
1074
|
+
str.sub!(/>$/, "")
|
1075
|
+
str << "\n className=%s," % className
|
1076
|
+
str << "\n propertyNames=Array (%d element(s))," % propertyNames.length unless propertyNames.length == 0
|
1077
|
+
str << "\n signalNames=Array (%d element(s))," % signalNames.length unless signalNames.length == 0
|
1078
|
+
str << "\n slotNames=Array (%d element(s))," % slotNames.length unless slotNames.length == 0
|
1079
|
+
str << "\n enumerators=Array (%d element(s))," % enumerators.length unless enumerators.length == 0
|
1080
|
+
str << "\n superClass=%s," % superClass.inspect unless superClass == nil
|
1081
|
+
str << "\n methodCount=%d," % methodCount
|
1082
|
+
str << "\n methodOffset=%d," % methodOffset
|
1083
|
+
str << "\n propertyCount=%d," % propertyCount
|
1084
|
+
str << "\n propertyOffset=%d," % propertyOffset
|
1085
|
+
str << "\n enumeratorCount=%d," % enumeratorCount
|
1086
|
+
str << "\n enumeratorOffset=%d," % enumeratorOffset
|
1087
|
+
str.chop!
|
1088
|
+
str << ">"
|
1089
|
+
pp.text str
|
1090
|
+
end
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
class MetaProperty < Qt::Base
|
1094
|
+
def name(*args)
|
1095
|
+
method_missing(:name, *args)
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
def type(*args)
|
1099
|
+
method_missing(:type, *args)
|
1100
|
+
end
|
1101
|
+
end
|
1102
|
+
|
1103
|
+
class MetaType < Qt::Base
|
1104
|
+
def load(*args)
|
1105
|
+
method_missing(:load, *args)
|
1106
|
+
end
|
1107
|
+
|
1108
|
+
def type(*args)
|
1109
|
+
method_missing(:type, *args)
|
1110
|
+
end
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
class MouseEvent < Qt::Base
|
1114
|
+
def type(*args)
|
1115
|
+
method_missing(:type, *args)
|
1116
|
+
end
|
1117
|
+
end
|
1118
|
+
|
1119
|
+
class MoveEvent < Qt::Base
|
1120
|
+
def type(*args)
|
1121
|
+
method_missing(:type, *args)
|
1122
|
+
end
|
1123
|
+
end
|
1124
|
+
|
1125
|
+
class Movie < Qt::Base
|
1126
|
+
def format(*args)
|
1127
|
+
method_missing(:format, *args)
|
1128
|
+
end
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
class NetworkProxy < Qt::Base
|
1132
|
+
def type(*args)
|
1133
|
+
method_missing(:type, *args)
|
1134
|
+
end
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
class Object < Qt::Base
|
1138
|
+
end
|
1139
|
+
|
1140
|
+
class PageSetupDialog < Qt::Base
|
1141
|
+
def exec(*args)
|
1142
|
+
method_missing(:exec, *args)
|
1143
|
+
end
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
class PaintEvent < Qt::Base
|
1147
|
+
def type(*args)
|
1148
|
+
method_missing(:type, *args)
|
1149
|
+
end
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
class Picture < Qt::Base
|
1153
|
+
def load(*args)
|
1154
|
+
method_missing(:load, *args)
|
1155
|
+
end
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
class PictureIO < Qt::Base
|
1159
|
+
def format(*args)
|
1160
|
+
method_missing(:format, *args)
|
1161
|
+
end
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
class Pixmap < Qt::Base
|
1165
|
+
def load(*args)
|
1166
|
+
method_missing(:load, *args)
|
1167
|
+
end
|
1168
|
+
end
|
1169
|
+
|
1170
|
+
class PluginLoader < Qt::Base
|
1171
|
+
def load(*args)
|
1172
|
+
method_missing(:load, *args)
|
1173
|
+
end
|
1174
|
+
end
|
1175
|
+
|
1176
|
+
class Point < Qt::Base
|
1177
|
+
def inspect
|
1178
|
+
str = super
|
1179
|
+
str.sub(/>$/, " x=%d, y=%d>" % [x, y])
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
def pretty_print(pp)
|
1183
|
+
str = to_s
|
1184
|
+
pp.text str.sub(/>$/, "\n x=%d,\n y=%d>" % [x, y])
|
1185
|
+
end
|
1186
|
+
end
|
1187
|
+
|
1188
|
+
class PointF < Qt::Base
|
1189
|
+
def inspect
|
1190
|
+
str = super
|
1191
|
+
str.sub(/>$/, " x=%f, y=%f>" % [x, y])
|
1192
|
+
end
|
1193
|
+
|
1194
|
+
def pretty_print(pp)
|
1195
|
+
str = to_s
|
1196
|
+
pp.text str.sub(/>$/, "\n x=%f,\n y=%f>" % [x, y])
|
1197
|
+
end
|
1198
|
+
end
|
1199
|
+
|
1200
|
+
class PrintDialog < Qt::Base
|
1201
|
+
def exec(*args)
|
1202
|
+
method_missing(:exec, *args)
|
1203
|
+
end
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
class Printer < Qt::Base
|
1207
|
+
def abort(*args)
|
1208
|
+
method_missing(:abort, *args)
|
1209
|
+
end
|
1210
|
+
end
|
1211
|
+
|
1212
|
+
class PushButton < Qt::Base
|
1213
|
+
def setShortcut(arg)
|
1214
|
+
if arg.kind_of?(String)
|
1215
|
+
return super(Qt::KeySequence.new(arg))
|
1216
|
+
else
|
1217
|
+
return super(arg)
|
1218
|
+
end
|
1219
|
+
end
|
1220
|
+
|
1221
|
+
def shortcut=(arg)
|
1222
|
+
setShortcut(arg)
|
1223
|
+
end
|
1224
|
+
end
|
1225
|
+
|
1226
|
+
class Line < Qt::Base
|
1227
|
+
def inspect
|
1228
|
+
str = super
|
1229
|
+
str.sub(/>$/, " x1=%d, y1=%d, x2=%d, y2=%d>" % [x1, y1, x2, y2])
|
1230
|
+
end
|
1231
|
+
|
1232
|
+
def pretty_print(pp)
|
1233
|
+
str = to_s
|
1234
|
+
pp.text str.sub(/>$/, "\n x1=%d,\n y1=%d,\n x2=%d,\n y2=%d>" % [x1, y1, x2, y2])
|
1235
|
+
end
|
1236
|
+
end
|
1237
|
+
|
1238
|
+
class LineF < Qt::Base
|
1239
|
+
def inspect
|
1240
|
+
str = super
|
1241
|
+
str.sub(/>$/, " x1=%f, y1=%f, x2=%f, y2=%f>" % [x1, y1, x2, y2])
|
1242
|
+
end
|
1243
|
+
|
1244
|
+
def pretty_print(pp)
|
1245
|
+
str = to_s
|
1246
|
+
pp.text str.sub(/>$/, "\n x1=%f,\n y1=%f,\n x2=%f,\n y2=%f>" % [x1, y1, x2, y2])
|
1247
|
+
end
|
1248
|
+
end
|
1249
|
+
|
1250
|
+
class MetaType < Qt::Base
|
1251
|
+
def self.type(*args)
|
1252
|
+
method_missing(:type, *args)
|
1253
|
+
end
|
1254
|
+
end
|
1255
|
+
|
1256
|
+
class ModelIndex < Qt::Base
|
1257
|
+
def inspect
|
1258
|
+
str = super
|
1259
|
+
str.sub(/>$/, " valid?=%s, row=%s, column=%s>" % [valid?, row, column])
|
1260
|
+
end
|
1261
|
+
|
1262
|
+
def pretty_print(pp)
|
1263
|
+
str = to_s
|
1264
|
+
pp.text str.sub(/>$/, "\n valid?=%s,\n row=%s,\n column=%s>" % [valid?, row, column])
|
1265
|
+
end
|
1266
|
+
end
|
1267
|
+
|
1268
|
+
class RadioButton < Qt::Base
|
1269
|
+
def setShortcut(arg)
|
1270
|
+
if arg.kind_of?(String)
|
1271
|
+
return super(Qt::KeySequence.new(arg))
|
1272
|
+
else
|
1273
|
+
return super(arg)
|
1274
|
+
end
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
def shortcut=(arg)
|
1278
|
+
setShortcut(arg)
|
1279
|
+
end
|
1280
|
+
end
|
1281
|
+
|
1282
|
+
class Rect < Qt::Base
|
1283
|
+
def inspect
|
1284
|
+
str = super
|
1285
|
+
str.sub(/>$/, " left=%d, right=%d, top=%d, bottom=%d>" % [left, right, top, bottom])
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
def pretty_print(pp)
|
1289
|
+
str = to_s
|
1290
|
+
pp.text str.sub(/>$/, "\n left=%d,\n right=%d,\n top=%d,\n bottom=%d>" % [left, right, top, bottom])
|
1291
|
+
end
|
1292
|
+
end
|
1293
|
+
|
1294
|
+
class RectF < Qt::Base
|
1295
|
+
def inspect
|
1296
|
+
str = super
|
1297
|
+
str.sub(/>$/, " left=%f, right=%f, top=%f, bottom=%f>" % [left, right, top, bottom])
|
1298
|
+
end
|
1299
|
+
|
1300
|
+
def pretty_print(pp)
|
1301
|
+
str = to_s
|
1302
|
+
pp.text str.sub(/>$/, "\n left=%f,\n right=%f,\n top=%f,\n bottom=%f>" % [left, right, top, bottom])
|
1303
|
+
end
|
1304
|
+
end
|
1305
|
+
|
1306
|
+
class ResizeEvent < Qt::Base
|
1307
|
+
def type(*args)
|
1308
|
+
method_missing(:type, *args)
|
1309
|
+
end
|
1310
|
+
end
|
1311
|
+
|
1312
|
+
class Shortcut < Qt::Base
|
1313
|
+
def id(*args)
|
1314
|
+
method_missing(:id, *args)
|
1315
|
+
end
|
1316
|
+
end
|
1317
|
+
|
1318
|
+
class ShortcutEvent < Qt::Base
|
1319
|
+
def type(*args)
|
1320
|
+
method_missing(:type, *args)
|
1321
|
+
end
|
1322
|
+
end
|
1323
|
+
|
1324
|
+
class ShowEvent < Qt::Base
|
1325
|
+
def type(*args)
|
1326
|
+
method_missing(:type, *args)
|
1327
|
+
end
|
1328
|
+
end
|
1329
|
+
|
1330
|
+
class Size < Qt::Base
|
1331
|
+
def inspect
|
1332
|
+
str = super
|
1333
|
+
str.sub(/>$/, " width=%d, height=%d>" % [width, height])
|
1334
|
+
end
|
1335
|
+
|
1336
|
+
def pretty_print(pp)
|
1337
|
+
str = to_s
|
1338
|
+
pp.text str.sub(/>$/, "\n width=%d,\n height=%d>" % [width, height])
|
1339
|
+
end
|
1340
|
+
end
|
1341
|
+
|
1342
|
+
class SizeF < Qt::Base
|
1343
|
+
def inspect
|
1344
|
+
str = super
|
1345
|
+
str.sub(/>$/, " width=%f, height=%f>" % [width, height])
|
1346
|
+
end
|
1347
|
+
|
1348
|
+
def pretty_print(pp)
|
1349
|
+
str = to_s
|
1350
|
+
pp.text str.sub(/>$/, "\n width=%f,\n height=%f>" % [width, height])
|
1351
|
+
end
|
1352
|
+
end
|
1353
|
+
|
1354
|
+
class SizePolicy < Qt::Base
|
1355
|
+
def inspect
|
1356
|
+
str = super
|
1357
|
+
str.sub(/>$/, " horData=%d, verData=%d>" % [horData, verData])
|
1358
|
+
end
|
1359
|
+
|
1360
|
+
def pretty_print(pp)
|
1361
|
+
str = to_s
|
1362
|
+
pp.text str.sub(/>$/, "\n horData=%d,\n verData=%d>" % [horData, verData])
|
1363
|
+
end
|
1364
|
+
end
|
1365
|
+
|
1366
|
+
class SocketNotifier < Qt::Base
|
1367
|
+
def type(*args)
|
1368
|
+
method_missing(:type, *args)
|
1369
|
+
end
|
1370
|
+
end
|
1371
|
+
|
1372
|
+
class SqlDatabase < Qt::Base
|
1373
|
+
def exec(*args)
|
1374
|
+
method_missing(:exec, *args)
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
def open(*args)
|
1378
|
+
method_missing(:open, *args)
|
1379
|
+
end
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
class SqlError < Qt::Base
|
1383
|
+
def type(*args)
|
1384
|
+
method_missing(:type, *args)
|
1385
|
+
end
|
1386
|
+
end
|
1387
|
+
|
1388
|
+
class SqlField < Qt::Base
|
1389
|
+
def name(*args)
|
1390
|
+
method_missing(:name, *args)
|
1391
|
+
end
|
1392
|
+
|
1393
|
+
def type(*args)
|
1394
|
+
method_missing(:type, *args)
|
1395
|
+
end
|
1396
|
+
end
|
1397
|
+
|
1398
|
+
class SqlIndex < Qt::Base
|
1399
|
+
def name(*args)
|
1400
|
+
method_missing(:name, *args)
|
1401
|
+
end
|
1402
|
+
end
|
1403
|
+
|
1404
|
+
class SqlQuery < Qt::Base
|
1405
|
+
def exec(*args)
|
1406
|
+
method_missing(:exec, *args)
|
1407
|
+
end
|
1408
|
+
end
|
1409
|
+
|
1410
|
+
class SqlResult < Qt::Base
|
1411
|
+
def exec(*args)
|
1412
|
+
method_missing(:exec, *args)
|
1413
|
+
end
|
1414
|
+
end
|
1415
|
+
|
1416
|
+
class SqlTableModel < Qt::Base
|
1417
|
+
def select(*k)
|
1418
|
+
method_missing(:select, *k)
|
1419
|
+
end
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
class StandardItem < Qt::Base
|
1423
|
+
def type(*args)
|
1424
|
+
method_missing(:type, *args)
|
1425
|
+
end
|
1426
|
+
end
|
1427
|
+
|
1428
|
+
class StandardItemModel < Qt::Base
|
1429
|
+
def type(*args)
|
1430
|
+
method_missing(:type, *args)
|
1431
|
+
end
|
1432
|
+
end
|
1433
|
+
|
1434
|
+
class StatusTipEvent < Qt::Base
|
1435
|
+
def type(*args)
|
1436
|
+
method_missing(:type, *args)
|
1437
|
+
end
|
1438
|
+
end
|
1439
|
+
|
1440
|
+
class StyleHintReturn < Qt::Base
|
1441
|
+
def type(*args)
|
1442
|
+
method_missing(:type, *args)
|
1443
|
+
end
|
1444
|
+
end
|
1445
|
+
|
1446
|
+
class StyleOption < Qt::Base
|
1447
|
+
def type(*args)
|
1448
|
+
method_missing(:type, *args)
|
1449
|
+
end
|
1450
|
+
end
|
1451
|
+
|
1452
|
+
class SyntaxHighlighter < Qt::Base
|
1453
|
+
def format(*args)
|
1454
|
+
method_missing(:format, *args)
|
1455
|
+
end
|
1456
|
+
end
|
1457
|
+
|
1458
|
+
class TableWidgetItem < Qt::Base
|
1459
|
+
def clone(*args)
|
1460
|
+
method_missing(:clone, *args)
|
1461
|
+
end
|
1462
|
+
|
1463
|
+
def type(*args)
|
1464
|
+
method_missing(:type, *args)
|
1465
|
+
end
|
1466
|
+
|
1467
|
+
def inspect
|
1468
|
+
str = super
|
1469
|
+
str.sub(/>$/, " text=%s>" % text)
|
1470
|
+
end
|
1471
|
+
|
1472
|
+
def pretty_print(pp)
|
1473
|
+
str = to_s
|
1474
|
+
pp.text str.sub(/>$/, " text=%s>" % text)
|
1475
|
+
end
|
1476
|
+
end
|
1477
|
+
|
1478
|
+
class TemporaryFile < Qt::Base
|
1479
|
+
def open(*args)
|
1480
|
+
method_missing(:open, *args)
|
1481
|
+
end
|
1482
|
+
end
|
1483
|
+
|
1484
|
+
class TextCursor < Qt::Base
|
1485
|
+
def select(*k)
|
1486
|
+
method_missing(:select, *k)
|
1487
|
+
end
|
1488
|
+
end
|
1489
|
+
|
1490
|
+
class TextDocument < Qt::Base
|
1491
|
+
def clone(*args)
|
1492
|
+
method_missing(:clone, *args)
|
1493
|
+
end
|
1494
|
+
|
1495
|
+
def print(*args)
|
1496
|
+
method_missing(:print, *args)
|
1497
|
+
end
|
1498
|
+
end
|
1499
|
+
|
1500
|
+
class TextFormat < Qt::Base
|
1501
|
+
def type(*args)
|
1502
|
+
method_missing(:type, *args)
|
1503
|
+
end
|
1504
|
+
end
|
1505
|
+
|
1506
|
+
class TextImageFormat < Qt::Base
|
1507
|
+
def name(*args)
|
1508
|
+
method_missing(:name, *args)
|
1509
|
+
end
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
class TextInlineObject < Qt::Base
|
1513
|
+
def format(*args)
|
1514
|
+
method_missing(:format, *args)
|
1515
|
+
end
|
1516
|
+
end
|
1517
|
+
|
1518
|
+
class TextLength < Qt::Base
|
1519
|
+
def type(*args)
|
1520
|
+
method_missing(:type, *args)
|
1521
|
+
end
|
1522
|
+
end
|
1523
|
+
|
1524
|
+
class TextList < Qt::Base
|
1525
|
+
def format(*args)
|
1526
|
+
method_missing(:format, *args)
|
1527
|
+
end
|
1528
|
+
end
|
1529
|
+
|
1530
|
+
class TextObject < Qt::Base
|
1531
|
+
def format(*args)
|
1532
|
+
method_missing(:format, *args)
|
1533
|
+
end
|
1534
|
+
end
|
1535
|
+
|
1536
|
+
class TextTable < Qt::Base
|
1537
|
+
def format(*args)
|
1538
|
+
method_missing(:format, *args)
|
1539
|
+
end
|
1540
|
+
end
|
1541
|
+
|
1542
|
+
class TextTableCell < Qt::Base
|
1543
|
+
def format(*args)
|
1544
|
+
method_missing(:format, *args)
|
1545
|
+
end
|
1546
|
+
end
|
1547
|
+
|
1548
|
+
class Time < Qt::Base
|
1549
|
+
def initialize(*args)
|
1550
|
+
if args.size == 1 && args[0].class.name == "Time"
|
1551
|
+
return super(args[0].hour, args[0].min, args[0].sec)
|
1552
|
+
else
|
1553
|
+
return super(*args)
|
1554
|
+
end
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
def inspect
|
1558
|
+
str = super
|
1559
|
+
str.sub(/>$/, " %s>" % toString)
|
1560
|
+
end
|
1561
|
+
|
1562
|
+
def pretty_print(pp)
|
1563
|
+
str = to_s
|
1564
|
+
pp.text str.sub(/>$/, " %s>" % toString)
|
1565
|
+
end
|
1566
|
+
end
|
1567
|
+
|
1568
|
+
class TimerEvent < Qt::Base
|
1569
|
+
def type(*args)
|
1570
|
+
method_missing(:type, *args)
|
1571
|
+
end
|
1572
|
+
end
|
1573
|
+
|
1574
|
+
class ToolButton < Qt::Base
|
1575
|
+
def setShortcut(arg)
|
1576
|
+
if arg.kind_of?(String)
|
1577
|
+
return super(Qt::KeySequence.new(arg))
|
1578
|
+
else
|
1579
|
+
return super(arg)
|
1580
|
+
end
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
def shortcut=(arg)
|
1584
|
+
setShortcut(arg)
|
1585
|
+
end
|
1586
|
+
end
|
1587
|
+
|
1588
|
+
class Translator < Qt::Base
|
1589
|
+
def load(*args)
|
1590
|
+
method_missing(:load, *args)
|
1591
|
+
end
|
1592
|
+
end
|
1593
|
+
|
1594
|
+
class TreeWidget < Qt::Base
|
1595
|
+
include Enumerable
|
1596
|
+
|
1597
|
+
def each
|
1598
|
+
it = Qt::TreeWidgetItemIterator.new(self)
|
1599
|
+
while it.current
|
1600
|
+
yield it.current
|
1601
|
+
it += 1
|
1602
|
+
end
|
1603
|
+
end
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
class TreeWidgetItem < Qt::Base
|
1607
|
+
include Enumerable
|
1608
|
+
|
1609
|
+
def initialize(*args)
|
1610
|
+
# There is not way to distinguish between the copy constructor
|
1611
|
+
# QTreeWidgetItem (const QTreeWidgetItem & other)
|
1612
|
+
# and
|
1613
|
+
# QTreeWidgetItem (QTreeWidgetItem * parent, const QStringList & strings, int type = Type)
|
1614
|
+
# when the latter has a single argument. So force the second variant to be called
|
1615
|
+
if args.length == 1 && args[0].kind_of?(Qt::TreeWidgetItem)
|
1616
|
+
super(args[0], Qt::TreeWidgetItem::Type)
|
1617
|
+
else
|
1618
|
+
super(*args)
|
1619
|
+
end
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
def inspect
|
1623
|
+
str = super
|
1624
|
+
str.sub!(/>$/, "")
|
1625
|
+
str << " parent=%s," % parent unless parent.nil?
|
1626
|
+
for i in 0..(columnCount - 1)
|
1627
|
+
str << " text%d=%s," % [i, self.text(i)]
|
1628
|
+
end
|
1629
|
+
str.sub!(/,?$/, ">")
|
1630
|
+
end
|
1631
|
+
|
1632
|
+
def pretty_print(pp)
|
1633
|
+
str = to_s
|
1634
|
+
str.sub!(/>$/, "")
|
1635
|
+
str << " parent=%s," % parent unless parent.nil?
|
1636
|
+
for i in 0..(columnCount - 1)
|
1637
|
+
str << " text%d=%s," % [i, self.text(i)]
|
1638
|
+
end
|
1639
|
+
str.sub!(/,?$/, ">")
|
1640
|
+
pp.text str
|
1641
|
+
end
|
1642
|
+
|
1643
|
+
def clone(*args)
|
1644
|
+
method_missing(:clone, *args)
|
1645
|
+
end
|
1646
|
+
|
1647
|
+
def type(*args)
|
1648
|
+
method_missing(:type, *args)
|
1649
|
+
end
|
1650
|
+
|
1651
|
+
def each
|
1652
|
+
it = Qt::TreeWidgetItemIterator.new(self)
|
1653
|
+
while it.current
|
1654
|
+
yield it.current
|
1655
|
+
it += 1
|
1656
|
+
end
|
1657
|
+
end
|
1658
|
+
end
|
1659
|
+
|
1660
|
+
class TreeWidgetItemIterator < Qt::Base
|
1661
|
+
def current
|
1662
|
+
return send("operator*".to_sym)
|
1663
|
+
end
|
1664
|
+
end
|
1665
|
+
|
1666
|
+
class UrlInfo < Qt::Base
|
1667
|
+
def name(*args)
|
1668
|
+
method_missing(:name, *args)
|
1669
|
+
end
|
1670
|
+
end
|
1671
|
+
|
1672
|
+
class Variant < Qt::Base
|
1673
|
+
String = 10
|
1674
|
+
Date = 14
|
1675
|
+
Time = 15
|
1676
|
+
DateTime = 16
|
1677
|
+
|
1678
|
+
def initialize(*args)
|
1679
|
+
if args.size == 1 && args[0].nil?
|
1680
|
+
return super()
|
1681
|
+
elsif args.size == 1 && args[0].class.name == "Date"
|
1682
|
+
return super(Qt::Date.new(args[0]))
|
1683
|
+
elsif args.size == 1 && args[0].class.name == "DateTime"
|
1684
|
+
return super(Qt::DateTime.new( Qt::Date.new(args[0].year, args[0].month, args[0].day),
|
1685
|
+
Qt::Time.new(args[0].hour, args[0].min, args[0].sec) ) )
|
1686
|
+
elsif args.size == 1 && args[0].class.name == "Time"
|
1687
|
+
return super(Qt::Time.new(args[0]))
|
1688
|
+
else
|
1689
|
+
return super(*args)
|
1690
|
+
end
|
1691
|
+
end
|
1692
|
+
|
1693
|
+
def to_a
|
1694
|
+
return toStringList()
|
1695
|
+
end
|
1696
|
+
|
1697
|
+
def to_f
|
1698
|
+
return toDouble()
|
1699
|
+
end
|
1700
|
+
|
1701
|
+
def to_i
|
1702
|
+
return toInt()
|
1703
|
+
end
|
1704
|
+
|
1705
|
+
def to_int
|
1706
|
+
return toInt()
|
1707
|
+
end
|
1708
|
+
|
1709
|
+
def value
|
1710
|
+
case type()
|
1711
|
+
when Qt::Variant::Bitmap
|
1712
|
+
when Qt::Variant::Bool
|
1713
|
+
return toBool
|
1714
|
+
when Qt::Variant::Brush
|
1715
|
+
return qVariantValue(Qt::Brush, self)
|
1716
|
+
when Qt::Variant::ByteArray
|
1717
|
+
return toByteArray
|
1718
|
+
when Qt::Variant::Char
|
1719
|
+
return qVariantValue(Qt::Char, self)
|
1720
|
+
when Qt::Variant::Color
|
1721
|
+
return qVariantValue(Qt::Color, self)
|
1722
|
+
when Qt::Variant::Cursor
|
1723
|
+
return qVariantValue(Qt::Cursor, self)
|
1724
|
+
when Qt::Variant::Date
|
1725
|
+
return toDate
|
1726
|
+
when Qt::Variant::DateTime
|
1727
|
+
return toDateTime
|
1728
|
+
when Qt::Variant::Double
|
1729
|
+
return toDouble
|
1730
|
+
when Qt::Variant::Font
|
1731
|
+
return qVariantValue(Qt::Font, self)
|
1732
|
+
when Qt::Variant::Icon
|
1733
|
+
return qVariantValue(Qt::Icon, self)
|
1734
|
+
when Qt::Variant::Image
|
1735
|
+
return qVariantValue(Qt::Image, self)
|
1736
|
+
when Qt::Variant::Int
|
1737
|
+
return toInt
|
1738
|
+
when Qt::Variant::KeySequence
|
1739
|
+
return qVariantValue(Qt::KeySequence, self)
|
1740
|
+
when Qt::Variant::Line
|
1741
|
+
return toLine
|
1742
|
+
when Qt::Variant::LineF
|
1743
|
+
return toLineF
|
1744
|
+
when Qt::Variant::List
|
1745
|
+
return toList
|
1746
|
+
when Qt::Variant::Locale
|
1747
|
+
return qVariantValue(Qt::Locale, self)
|
1748
|
+
when Qt::Variant::LongLong
|
1749
|
+
return toLongLong
|
1750
|
+
when Qt::Variant::Map
|
1751
|
+
return toMap
|
1752
|
+
when Qt::Variant::Palette
|
1753
|
+
return qVariantValue(Qt::Palette, self)
|
1754
|
+
when Qt::Variant::Pen
|
1755
|
+
return qVariantValue(Qt::Pen, self)
|
1756
|
+
when Qt::Variant::Pixmap
|
1757
|
+
return qVariantValue(Qt::Pixmap, self)
|
1758
|
+
when Qt::Variant::Point
|
1759
|
+
return toPoint
|
1760
|
+
when Qt::Variant::PointF
|
1761
|
+
return toPointF
|
1762
|
+
when Qt::Variant::Polygon
|
1763
|
+
return qVariantValue(Qt::Polygon, self)
|
1764
|
+
when Qt::Variant::Rect
|
1765
|
+
return toRect
|
1766
|
+
when Qt::Variant::RectF
|
1767
|
+
return toRectF
|
1768
|
+
when Qt::Variant::RegExp
|
1769
|
+
return toRegExp
|
1770
|
+
when Qt::Variant::Region
|
1771
|
+
return qVariantValue(Qt::Region, self)
|
1772
|
+
when Qt::Variant::Size
|
1773
|
+
return toSize
|
1774
|
+
when Qt::Variant::SizeF
|
1775
|
+
return toSizeF
|
1776
|
+
when Qt::Variant::SizePolicy
|
1777
|
+
return toSizePolicy
|
1778
|
+
when Qt::Variant::String
|
1779
|
+
return toString
|
1780
|
+
when Qt::Variant::StringList
|
1781
|
+
return toStringList
|
1782
|
+
when Qt::Variant::TextFormat
|
1783
|
+
return qVariantValue(Qt::TextFormat, self)
|
1784
|
+
when Qt::Variant::TextLength
|
1785
|
+
return qVariantValue(Qt::TextLength, self)
|
1786
|
+
when Qt::Variant::Time
|
1787
|
+
return toTime
|
1788
|
+
when Qt::Variant::UInt
|
1789
|
+
return toUInt
|
1790
|
+
when Qt::Variant::ULongLong
|
1791
|
+
return toULongLong
|
1792
|
+
when Qt::Variant::Url
|
1793
|
+
return toUrl
|
1794
|
+
end
|
1795
|
+
|
1796
|
+
case typeName()
|
1797
|
+
when "QDBusArgument"
|
1798
|
+
return qVariantValue(Qt::DBusArgument, self)
|
1799
|
+
when "QDBusVariant"
|
1800
|
+
return qVariantValue(Qt::Variant, self)
|
1801
|
+
end
|
1802
|
+
end
|
1803
|
+
|
1804
|
+
def inspect
|
1805
|
+
str = super
|
1806
|
+
str.sub(/>$/, " typeName=%s>" % typeName)
|
1807
|
+
end
|
1808
|
+
|
1809
|
+
def pretty_print(pp)
|
1810
|
+
str = to_s
|
1811
|
+
pp.text str.sub(/>$/, " typeName=%s>" % typeName)
|
1812
|
+
end
|
1813
|
+
|
1814
|
+
def load(*args)
|
1815
|
+
method_missing(:load, *args)
|
1816
|
+
end
|
1817
|
+
|
1818
|
+
def type(*args)
|
1819
|
+
method_missing(:type, *args)
|
1820
|
+
end
|
1821
|
+
end
|
1822
|
+
|
1823
|
+
class DBusVariant < Variant
|
1824
|
+
def initialize(value)
|
1825
|
+
if value.kind_of? Qt::Variant
|
1826
|
+
super(value)
|
1827
|
+
else
|
1828
|
+
super(Qt::Variant.new(value))
|
1829
|
+
end
|
1830
|
+
end
|
1831
|
+
|
1832
|
+
def setVariant(variant)
|
1833
|
+
end
|
1834
|
+
|
1835
|
+
def variant=(variant)
|
1836
|
+
setVariant(variant)
|
1837
|
+
end
|
1838
|
+
|
1839
|
+
def variant()
|
1840
|
+
return self
|
1841
|
+
end
|
1842
|
+
end
|
1843
|
+
|
1844
|
+
class WhatsThisClickedEvent < Qt::Base
|
1845
|
+
def type(*args)
|
1846
|
+
method_missing(:type, *args)
|
1847
|
+
end
|
1848
|
+
end
|
1849
|
+
|
1850
|
+
class Widget < Qt::Base
|
1851
|
+
def raise(*args)
|
1852
|
+
method_missing(:raise, *args)
|
1853
|
+
end
|
1854
|
+
end
|
1855
|
+
|
1856
|
+
class WindowStateChangeEvent < Qt::Base
|
1857
|
+
def type(*args)
|
1858
|
+
method_missing(:type, *args)
|
1859
|
+
end
|
1860
|
+
end
|
1861
|
+
|
1862
|
+
class XmlAttributes < Qt::Base
|
1863
|
+
def type(*args)
|
1864
|
+
method_missing(:type, *args)
|
1865
|
+
end
|
1866
|
+
end
|
1867
|
+
|
1868
|
+
# Provides a mutable numeric class for passing to methods with
|
1869
|
+
# C++ 'int*' or 'int&' arg types
|
1870
|
+
class Integer
|
1871
|
+
attr_accessor :value
|
1872
|
+
def initialize(n=0) @value = n end
|
1873
|
+
|
1874
|
+
def +(n)
|
1875
|
+
return Integer.new(@value + n.to_i)
|
1876
|
+
end
|
1877
|
+
def -(n)
|
1878
|
+
return Integer.new(@value - n.to_i)
|
1879
|
+
end
|
1880
|
+
def *(n)
|
1881
|
+
return Integer.new(@value * n.to_i)
|
1882
|
+
end
|
1883
|
+
def /(n)
|
1884
|
+
return Integer.new(@value / n.to_i)
|
1885
|
+
end
|
1886
|
+
def %(n)
|
1887
|
+
return Integer.new(@value % n.to_i)
|
1888
|
+
end
|
1889
|
+
def **(n)
|
1890
|
+
return Integer.new(@value ** n.to_i)
|
1891
|
+
end
|
1892
|
+
|
1893
|
+
def |(n)
|
1894
|
+
return Integer.new(@value | n.to_i)
|
1895
|
+
end
|
1896
|
+
def &(n)
|
1897
|
+
return Integer.new(@value & n.to_i)
|
1898
|
+
end
|
1899
|
+
def ^(n)
|
1900
|
+
return Integer.new(@value ^ n.to_i)
|
1901
|
+
end
|
1902
|
+
def <<(n)
|
1903
|
+
return Integer.new(@value << n.to_i)
|
1904
|
+
end
|
1905
|
+
def >>(n)
|
1906
|
+
return Integer.new(@value >> n.to_i)
|
1907
|
+
end
|
1908
|
+
def >(n)
|
1909
|
+
return @value > n.to_i
|
1910
|
+
end
|
1911
|
+
def >=(n)
|
1912
|
+
return @value >= n.to_i
|
1913
|
+
end
|
1914
|
+
def <(n)
|
1915
|
+
return @value < n.to_i
|
1916
|
+
end
|
1917
|
+
def <=(n)
|
1918
|
+
return @value <= n.to_i
|
1919
|
+
end
|
1920
|
+
|
1921
|
+
def <=>(n)
|
1922
|
+
if @value < n.to_i
|
1923
|
+
return -1
|
1924
|
+
elsif @value > n.to_i
|
1925
|
+
return 1
|
1926
|
+
else
|
1927
|
+
return 0
|
1928
|
+
end
|
1929
|
+
end
|
1930
|
+
|
1931
|
+
def to_f() return @value.to_f end
|
1932
|
+
def to_i() return @value.to_i end
|
1933
|
+
def to_s() return @value.to_s end
|
1934
|
+
|
1935
|
+
def coerce(n)
|
1936
|
+
[n, @value]
|
1937
|
+
end
|
1938
|
+
end
|
1939
|
+
|
1940
|
+
# If a C++ enum was converted to an ordinary ruby Integer, the
|
1941
|
+
# name of the type is lost. The enum type name is needed for overloaded
|
1942
|
+
# method resolution when two methods differ only by an enum type.
|
1943
|
+
class Enum
|
1944
|
+
attr_accessor :type, :value
|
1945
|
+
def initialize(n, type)
|
1946
|
+
super()
|
1947
|
+
@value = n
|
1948
|
+
@type = type
|
1949
|
+
end
|
1950
|
+
|
1951
|
+
def +(n)
|
1952
|
+
return @value + n.to_i
|
1953
|
+
end
|
1954
|
+
def -(n)
|
1955
|
+
return @value - n.to_i
|
1956
|
+
end
|
1957
|
+
def *(n)
|
1958
|
+
return @value * n.to_i
|
1959
|
+
end
|
1960
|
+
def /(n)
|
1961
|
+
return @value / n.to_i
|
1962
|
+
end
|
1963
|
+
def %(n)
|
1964
|
+
return @value % n.to_i
|
1965
|
+
end
|
1966
|
+
def **(n)
|
1967
|
+
return @value ** n.to_i
|
1968
|
+
end
|
1969
|
+
|
1970
|
+
def |(n)
|
1971
|
+
return Enum.new(@value | n.to_i, @type)
|
1972
|
+
end
|
1973
|
+
def &(n)
|
1974
|
+
return Enum.new(@value & n.to_i, @type)
|
1975
|
+
end
|
1976
|
+
def ^(n)
|
1977
|
+
return Enum.new(@value ^ n.to_i, @type)
|
1978
|
+
end
|
1979
|
+
def ~()
|
1980
|
+
return ~ @value
|
1981
|
+
end
|
1982
|
+
def <(n)
|
1983
|
+
return @value < n.to_i
|
1984
|
+
end
|
1985
|
+
def <=(n)
|
1986
|
+
return @value <= n.to_i
|
1987
|
+
end
|
1988
|
+
def >(n)
|
1989
|
+
return @value > n.to_i
|
1990
|
+
end
|
1991
|
+
def >=(n)
|
1992
|
+
return @value >= n.to_i
|
1993
|
+
end
|
1994
|
+
def <<(n)
|
1995
|
+
return Enum.new(@value << n.to_i, @type)
|
1996
|
+
end
|
1997
|
+
def >>(n)
|
1998
|
+
return Enum.new(@value >> n.to_i, @type)
|
1999
|
+
end
|
2000
|
+
|
2001
|
+
def ==(n) return @value == n.to_i end
|
2002
|
+
def to_i() return @value end
|
2003
|
+
|
2004
|
+
def to_f() return @value.to_f end
|
2005
|
+
def to_s() return @value.to_s end
|
2006
|
+
|
2007
|
+
def coerce(n)
|
2008
|
+
[n, @value]
|
2009
|
+
end
|
2010
|
+
|
2011
|
+
def inspect
|
2012
|
+
to_s
|
2013
|
+
end
|
2014
|
+
|
2015
|
+
def pretty_print(pp)
|
2016
|
+
pp.text "#<%s:0x%8.8x @type=%s, @value=%d>" % [self.class.name, object_id, type, value]
|
2017
|
+
end
|
2018
|
+
end
|
2019
|
+
|
2020
|
+
# Provides a mutable boolean class for passing to methods with
|
2021
|
+
# C++ 'bool*' or 'bool&' arg types
|
2022
|
+
class Boolean
|
2023
|
+
attr_accessor :value
|
2024
|
+
def initialize(b=false) @value = b end
|
2025
|
+
def nil?
|
2026
|
+
return !@value
|
2027
|
+
end
|
2028
|
+
end
|
2029
|
+
|
2030
|
+
class SignalBlockInvocation < Qt::Object
|
2031
|
+
def initialize(parent, block, signature)
|
2032
|
+
super(parent)
|
2033
|
+
if metaObject.indexOfSlot(signature) == -1
|
2034
|
+
self.class.slots signature
|
2035
|
+
end
|
2036
|
+
@block = block
|
2037
|
+
end
|
2038
|
+
|
2039
|
+
def invoke(*args)
|
2040
|
+
@block.call(*args)
|
2041
|
+
end
|
2042
|
+
end
|
2043
|
+
|
2044
|
+
class BlockInvocation < Qt::Object
|
2045
|
+
def initialize(target, block, signature)
|
2046
|
+
super(target)
|
2047
|
+
if metaObject.indexOfSlot(signature) == -1
|
2048
|
+
self.class.slots signature
|
2049
|
+
end
|
2050
|
+
@target = target
|
2051
|
+
@block = block
|
2052
|
+
end
|
2053
|
+
|
2054
|
+
def invoke(*args)
|
2055
|
+
@target.instance_exec(*args, &@block)
|
2056
|
+
end
|
2057
|
+
end
|
2058
|
+
|
2059
|
+
module Internal
|
2060
|
+
@@classes = {}
|
2061
|
+
@@cpp_names = {}
|
2062
|
+
@@idclass = []
|
2063
|
+
|
2064
|
+
def Internal.normalize_classname(classname)
|
2065
|
+
if classname =~ /^Qext/
|
2066
|
+
now = classname.sub(/^Qext(?=[A-Z])/,'Qext::')
|
2067
|
+
elsif classname =~ /^Qwt/
|
2068
|
+
now = classname.sub(/^Qwt(?=[A-Z])/,'Qwt::')
|
2069
|
+
elsif classname =~ /^Q3/
|
2070
|
+
now = classname.sub(/^Q3(?=[A-Z])/,'Qt3::')
|
2071
|
+
elsif classname =~ /^Q/
|
2072
|
+
now = classname.sub(/^Q(?=[A-Z])/,'Qt::')
|
2073
|
+
elsif classname =~ /^(KConfigSkeleton|KWin)::/
|
2074
|
+
now = classname.sub(/^K?(?=[A-Z])/,'KDE::')
|
2075
|
+
elsif classname !~ /::/
|
2076
|
+
now = classname.sub(/^K?(?=[A-Z])/,'KDE::')
|
2077
|
+
else
|
2078
|
+
now = classname
|
2079
|
+
end
|
2080
|
+
# puts "normalize_classname = was::#{classname}, now::#{now}"
|
2081
|
+
now
|
2082
|
+
end
|
2083
|
+
|
2084
|
+
def Internal.init_class(c)
|
2085
|
+
classname = Qt::Internal::normalize_classname(c)
|
2086
|
+
classId = Qt::Internal.idClass(c)
|
2087
|
+
insert_pclassid(classname, classId)
|
2088
|
+
@@idclass[classId] = classname
|
2089
|
+
@@cpp_names[classname] = c
|
2090
|
+
klass = isQObject(classId) ? create_qobject_class(classname) \
|
2091
|
+
: create_qt_class(classname)
|
2092
|
+
@@classes[classname] = klass unless klass.nil?
|
2093
|
+
end
|
2094
|
+
|
2095
|
+
def Internal.debug_level
|
2096
|
+
Qt.debug_level
|
2097
|
+
end
|
2098
|
+
|
2099
|
+
def Internal.checkarg(argtype, typename)
|
2100
|
+
puts " #{typename} (#{argtype})" if debug_level >= DebugLevel::High
|
2101
|
+
if argtype == 'i'
|
2102
|
+
if typename =~ /^int&?$|^signed int&?$|^signed$|^qint32&?$|^quint32&?$/
|
2103
|
+
return 2
|
2104
|
+
elsif typename =~ /^(?:short|ushort|unsigned short int|uchar|uint|long|ulong|unsigned long int|unsigned|float|double|WId|Q_PID|^quint16&?$|^qint16&?$)$/
|
2105
|
+
return 1
|
2106
|
+
elsif typename =~ /^(quint|qint|qulong|qlong|qreal)/
|
2107
|
+
return 1
|
2108
|
+
else
|
2109
|
+
t = typename.sub(/^const\s+/, '')
|
2110
|
+
t.sub!(/[&*]$/, '')
|
2111
|
+
if isEnum(t)
|
2112
|
+
return 0
|
2113
|
+
end
|
2114
|
+
end
|
2115
|
+
elsif argtype == 'n'
|
2116
|
+
if typename =~ /^double$|^qreal$/
|
2117
|
+
return 2
|
2118
|
+
elsif typename =~ /^float$/
|
2119
|
+
return 1
|
2120
|
+
elsif typename =~ /^int&?$/
|
2121
|
+
return 0
|
2122
|
+
elsif typename =~ /^(?:short|ushort|uint|long|ulong|signed|unsigned|float|double)$/
|
2123
|
+
return 0
|
2124
|
+
else
|
2125
|
+
t = typename.sub(/^const\s+/, '')
|
2126
|
+
t.sub!(/[&*]$/, '')
|
2127
|
+
if isEnum(t)
|
2128
|
+
return 0
|
2129
|
+
end
|
2130
|
+
end
|
2131
|
+
elsif argtype == 'B'
|
2132
|
+
if typename =~ /^(?:bool)[*&]?$/
|
2133
|
+
return 0
|
2134
|
+
end
|
2135
|
+
elsif argtype == 's'
|
2136
|
+
if typename =~ /^(const )?((QChar)[*&]?)$/
|
2137
|
+
return 1
|
2138
|
+
elsif typename =~ /^(?:u?char\*|const u?char\*|(?:const )?(Q(C?)String)[*&]?)$/
|
2139
|
+
qstring = !$1.nil?
|
2140
|
+
c = ("C" == $2)
|
2141
|
+
return c ? 2 : (qstring ? 3 : 0)
|
2142
|
+
end
|
2143
|
+
elsif argtype == 'a'
|
2144
|
+
# FIXME: shouldn't be hardcoded. Installed handlers should tell what ruby type they expect.
|
2145
|
+
if typename =~ /^(?:
|
2146
|
+
const\ QCOORD\*|
|
2147
|
+
(?:const\ )?
|
2148
|
+
(?:
|
2149
|
+
QStringList[\*&]?|
|
2150
|
+
QValueList<int>[\*&]?|
|
2151
|
+
QRgb\*|
|
2152
|
+
char\*\*
|
2153
|
+
)
|
2154
|
+
)$/x
|
2155
|
+
return 0
|
2156
|
+
end
|
2157
|
+
elsif argtype == 'u'
|
2158
|
+
# Give nil matched against string types a higher score than anything else
|
2159
|
+
if typename =~ /^(?:u?char\*|const u?char\*|(?:const )?((Q(C?)String))[*&]?)$/
|
2160
|
+
return 1
|
2161
|
+
# Numerics will give a runtime conversion error, so they fail the match
|
2162
|
+
elsif typename =~ /^(?:short|ushort|uint|long|ulong|signed|unsigned|int)$/
|
2163
|
+
return -99
|
2164
|
+
else
|
2165
|
+
return 0
|
2166
|
+
end
|
2167
|
+
elsif argtype == 'U'
|
2168
|
+
if typename =~ /QStringList/
|
2169
|
+
return 1
|
2170
|
+
else
|
2171
|
+
return 0
|
2172
|
+
end
|
2173
|
+
else
|
2174
|
+
t = typename.sub(/^const\s+/, '')
|
2175
|
+
t.sub!(/[&*]$/, '')
|
2176
|
+
if argtype == t
|
2177
|
+
return 1
|
2178
|
+
elsif classIsa(argtype, t)
|
2179
|
+
return 0
|
2180
|
+
elsif isEnum(argtype) and
|
2181
|
+
(t =~ /int|qint32|uint|quint32|long|ulong/ or isEnum(t))
|
2182
|
+
return 0
|
2183
|
+
end
|
2184
|
+
end
|
2185
|
+
return -99
|
2186
|
+
end
|
2187
|
+
|
2188
|
+
def Internal.find_class(classname)
|
2189
|
+
# puts @@classes.keys.sort.join "\n"
|
2190
|
+
@@classes[classname]
|
2191
|
+
end
|
2192
|
+
|
2193
|
+
# Runs the initializer as far as allocating the Qt C++ instance.
|
2194
|
+
# Then use a throw to jump back to here with the C++ instance
|
2195
|
+
# wrapped in a new ruby variable of type T_DATA
|
2196
|
+
def Internal.try_initialize(instance, *args)
|
2197
|
+
initializer = instance.method(:initialize)
|
2198
|
+
catch "newqt" do
|
2199
|
+
initializer.call(*args)
|
2200
|
+
end
|
2201
|
+
end
|
2202
|
+
|
2203
|
+
# If a block was passed to the constructor, then
|
2204
|
+
# run that now. Either run the context of the new instance
|
2205
|
+
# if no args were passed to the block. Or otherwise,
|
2206
|
+
# run the block in the context of the arg.
|
2207
|
+
def Internal.run_initializer_block(instance, block)
|
2208
|
+
if block.arity == -1
|
2209
|
+
instance.instance_eval(&block)
|
2210
|
+
elsif block.arity == 1
|
2211
|
+
block.call(instance)
|
2212
|
+
else
|
2213
|
+
raise ArgumentError, "Wrong number of arguments to block(#{block.arity} for 1)"
|
2214
|
+
end
|
2215
|
+
end
|
2216
|
+
|
2217
|
+
def Internal.do_method_missing(package, method, klass, this, *args)
|
2218
|
+
if klass.class == Module
|
2219
|
+
classname = klass.name
|
2220
|
+
else
|
2221
|
+
classname = @@cpp_names[klass.name]
|
2222
|
+
if classname.nil?
|
2223
|
+
if klass != Object and klass != Qt
|
2224
|
+
return do_method_missing(package, method, klass.superclass, this, *args)
|
2225
|
+
else
|
2226
|
+
return nil
|
2227
|
+
end
|
2228
|
+
end
|
2229
|
+
end
|
2230
|
+
|
2231
|
+
if method == "new"
|
2232
|
+
method = classname.dup
|
2233
|
+
method.gsub!(/^(QTextLayout|KParts|KIO|KNS|DOM|Kontact|Kate|KTextEditor|KConfigSkeleton::ItemEnum|KConfigSkeleton|KWin)::/,"")
|
2234
|
+
end
|
2235
|
+
method = "operator" + method.sub("@","") if method !~ /[a-zA-Z]+/
|
2236
|
+
# Change foobar= to setFoobar()
|
2237
|
+
method = 'set' + method[0,1].upcase + method[1,method.length].sub("=", "") if method =~ /.*[^-+%\/|=]=$/ && method != 'operator='
|
2238
|
+
|
2239
|
+
methods = []
|
2240
|
+
methods << method.dup
|
2241
|
+
args.each do |arg|
|
2242
|
+
if arg.nil?
|
2243
|
+
# For each nil arg encountered, triple the number of munged method
|
2244
|
+
# templates, in order to cover all possible types that can match nil
|
2245
|
+
temp = []
|
2246
|
+
methods.collect! do |meth|
|
2247
|
+
temp << meth + '?'
|
2248
|
+
temp << meth + '#'
|
2249
|
+
meth << '$'
|
2250
|
+
end
|
2251
|
+
methods.concat(temp)
|
2252
|
+
elsif isObject(arg)
|
2253
|
+
methods.collect! { |meth| meth << '#' }
|
2254
|
+
elsif arg.kind_of? Array or arg.kind_of? Hash
|
2255
|
+
methods.collect! { |meth| meth << '?' }
|
2256
|
+
else
|
2257
|
+
methods.collect! { |meth| meth << '$' }
|
2258
|
+
end
|
2259
|
+
end
|
2260
|
+
|
2261
|
+
methodIds = []
|
2262
|
+
methods.collect { |meth| methodIds.concat( findMethod(classname, meth) ) }
|
2263
|
+
|
2264
|
+
if method =~ /_/ && methodIds.length == 0
|
2265
|
+
# If the method name contains underscores, convert to camel case
|
2266
|
+
# form and try again
|
2267
|
+
method.gsub!(/(.)_(.)/) {$1 + $2.upcase}
|
2268
|
+
return do_method_missing(package, method, klass, this, *args)
|
2269
|
+
end
|
2270
|
+
|
2271
|
+
if debug_level >= DebugLevel::High
|
2272
|
+
puts "classname == #{classname}"
|
2273
|
+
puts ":: method == #{method}"
|
2274
|
+
puts "-> methodIds == #{methodIds.inspect}"
|
2275
|
+
puts "candidate list:"
|
2276
|
+
prototypes = dumpCandidates(methodIds).split("\n")
|
2277
|
+
line_len = (prototypes.collect { |p| p.length }).max
|
2278
|
+
prototypes.zip(methodIds) {
|
2279
|
+
|prototype,id| puts "#{prototype.ljust line_len} (#{id})"
|
2280
|
+
}
|
2281
|
+
end
|
2282
|
+
|
2283
|
+
chosen = nil
|
2284
|
+
if methodIds.length > 0
|
2285
|
+
best_match = -1
|
2286
|
+
methodIds.each do
|
2287
|
+
|id|
|
2288
|
+
puts "matching => #{id}" if debug_level >= DebugLevel::High
|
2289
|
+
current_match = 0
|
2290
|
+
(0...args.length).each do
|
2291
|
+
|i|
|
2292
|
+
current_match += checkarg( getVALUEtype(args[i]), getTypeNameOfArg(id, i) )
|
2293
|
+
end
|
2294
|
+
|
2295
|
+
# Note that if current_match > best_match, then chosen must be nil
|
2296
|
+
if current_match > best_match
|
2297
|
+
best_match = current_match
|
2298
|
+
chosen = id
|
2299
|
+
# Multiple matches are an error; the equality test below _cannot_ be commented out.
|
2300
|
+
# If ambiguous matches occur the problem must be fixed be adjusting the relative
|
2301
|
+
# ranking of the arg types involved in checkarg().
|
2302
|
+
elsif current_match == best_match
|
2303
|
+
chosen = nil
|
2304
|
+
end
|
2305
|
+
puts "match => #{id} score: #{current_match}" if debug_level >= DebugLevel::High
|
2306
|
+
end
|
2307
|
+
|
2308
|
+
puts "Resolved to id: #{chosen}" if !chosen.nil? && debug_level >= DebugLevel::High
|
2309
|
+
end
|
2310
|
+
|
2311
|
+
if debug_level >= DebugLevel::Minimal && chosen.nil? && method !~ /^operator/
|
2312
|
+
id = find_pclassid(normalize_classname(klass.name))
|
2313
|
+
hash = findAllMethods(id)
|
2314
|
+
constructor_names = nil
|
2315
|
+
if method == classname
|
2316
|
+
puts "No matching constructor found, possibles:\n"
|
2317
|
+
constructor_names = hash.keys.grep(/^#{classname}/)
|
2318
|
+
else
|
2319
|
+
puts "Possible prototypes:"
|
2320
|
+
constructor_names = hash.keys
|
2321
|
+
end
|
2322
|
+
method_ids = hash.values_at(*constructor_names).flatten
|
2323
|
+
puts dumpCandidates(method_ids)
|
2324
|
+
end
|
2325
|
+
|
2326
|
+
puts "setCurrentMethod(#{chosen})" if debug_level >= DebugLevel::High
|
2327
|
+
setCurrentMethod(chosen) if chosen
|
2328
|
+
return nil
|
2329
|
+
end
|
2330
|
+
|
2331
|
+
def Internal.init_all_classes()
|
2332
|
+
Qt::Internal::getClassList().each do |c|
|
2333
|
+
if c == "Qt"
|
2334
|
+
# Don't change Qt to Qt::t, just leave as is
|
2335
|
+
@@cpp_names["Qt"] = c
|
2336
|
+
elsif c != "QInternal"
|
2337
|
+
Qt::Internal::init_class(c)
|
2338
|
+
end
|
2339
|
+
end
|
2340
|
+
|
2341
|
+
@@classes['Qt::Integer'] = Qt::Integer
|
2342
|
+
@@classes['Qt::Boolean'] = Qt::Boolean
|
2343
|
+
@@classes['Qt::Enum'] = Qt::Enum
|
2344
|
+
end
|
2345
|
+
|
2346
|
+
def Internal.get_qinteger(num)
|
2347
|
+
return num.value
|
2348
|
+
end
|
2349
|
+
|
2350
|
+
def Internal.set_qinteger(num, val)
|
2351
|
+
return num.value = val
|
2352
|
+
end
|
2353
|
+
|
2354
|
+
def Internal.create_qenum(num, type)
|
2355
|
+
return Qt::Enum.new(num, type)
|
2356
|
+
end
|
2357
|
+
|
2358
|
+
def Internal.get_qenum_type(e)
|
2359
|
+
return e.type
|
2360
|
+
end
|
2361
|
+
|
2362
|
+
def Internal.get_qboolean(b)
|
2363
|
+
return b.value
|
2364
|
+
end
|
2365
|
+
|
2366
|
+
def Internal.set_qboolean(b, val)
|
2367
|
+
return b.value = val
|
2368
|
+
end
|
2369
|
+
|
2370
|
+
def Internal.getAllParents(class_id, res)
|
2371
|
+
getIsa(class_id).each do |s|
|
2372
|
+
c = idClass(s)
|
2373
|
+
res << c
|
2374
|
+
getAllParents(c, res)
|
2375
|
+
end
|
2376
|
+
end
|
2377
|
+
|
2378
|
+
def Internal.signalInfo(qobject, signal_name)
|
2379
|
+
signals = Meta[qobject.class.name].get_signals
|
2380
|
+
signals.each_with_index do |signal, i|
|
2381
|
+
if signal.name == signal_name
|
2382
|
+
return [signal.reply_type, signal.full_name, i]
|
2383
|
+
end
|
2384
|
+
end
|
2385
|
+
end
|
2386
|
+
|
2387
|
+
def Internal.getMocArguments(reply_type, member)
|
2388
|
+
argStr = member.sub(/.*\(/, '').sub(/\)$/, '')
|
2389
|
+
args = argStr.scan(/([^,]*<[^>]+>)|([^,]+)/)
|
2390
|
+
args.unshift reply_type
|
2391
|
+
mocargs = allocateMocArguments(args.length)
|
2392
|
+
args.each_with_index do |arg, i|
|
2393
|
+
arg = arg.to_s
|
2394
|
+
a = arg.sub(/^const\s+/, '')
|
2395
|
+
a = (a =~ /^(bool|int|double|char\*|QString)&?$/) ? $1 : 'ptr'
|
2396
|
+
valid = setMocType(mocargs, i, arg, a)
|
2397
|
+
end
|
2398
|
+
result = []
|
2399
|
+
result << args.length << mocargs
|
2400
|
+
result
|
2401
|
+
end
|
2402
|
+
|
2403
|
+
#
|
2404
|
+
# From the enum MethodFlags in qt-copy/src/tools/moc/generator.cpp
|
2405
|
+
#
|
2406
|
+
AccessPrivate = 0x00
|
2407
|
+
AccessProtected = 0x01
|
2408
|
+
AccessPublic = 0x02
|
2409
|
+
MethodMethod = 0x00
|
2410
|
+
MethodSignal = 0x04
|
2411
|
+
MethodSlot = 0x08
|
2412
|
+
MethodCompatibility = 0x10
|
2413
|
+
MethodCloned = 0x20
|
2414
|
+
MethodScriptable = 0x40
|
2415
|
+
|
2416
|
+
# Keeps a hash of strings against their corresponding offsets
|
2417
|
+
# within the qt_meta_stringdata sequence of null terminated
|
2418
|
+
# strings. Returns a proc to get an offset given a string.
|
2419
|
+
# That proc also adds new strings to the 'data' array, and updates
|
2420
|
+
# the corresponding 'pack_str' Array#pack template.
|
2421
|
+
def Internal.string_table_handler(data, pack_str)
|
2422
|
+
hsh = {}
|
2423
|
+
offset = 0
|
2424
|
+
return lambda do |str|
|
2425
|
+
if !hsh.has_key? str
|
2426
|
+
hsh[str] = offset
|
2427
|
+
data << str
|
2428
|
+
pack_str << "a*x"
|
2429
|
+
offset += str.length + 1
|
2430
|
+
end
|
2431
|
+
|
2432
|
+
return hsh[str]
|
2433
|
+
end
|
2434
|
+
end
|
2435
|
+
|
2436
|
+
def Internal.makeMetaData(classname, classinfos, dbus, signals, slots)
|
2437
|
+
# Each entry in 'stringdata' corresponds to a string in the
|
2438
|
+
# qt_meta_stringdata_<classname> structure.
|
2439
|
+
# 'pack_string' is used to convert 'stringdata' into the
|
2440
|
+
# binary sequence of null terminated strings for the metaObject
|
2441
|
+
stringdata = []
|
2442
|
+
pack_string = ""
|
2443
|
+
string_table = string_table_handler(stringdata, pack_string)
|
2444
|
+
|
2445
|
+
# This is used to create the array of uints that make up the
|
2446
|
+
# qt_meta_data_<classname> structure in the metaObject
|
2447
|
+
data = [1, # revision
|
2448
|
+
string_table.call(classname), # classname
|
2449
|
+
classinfos.length, classinfos.length > 0 ? 10 : 0, # classinfo
|
2450
|
+
signals.length + slots.length,
|
2451
|
+
10 + (2*classinfos.length), # methods
|
2452
|
+
0, 0, # properties
|
2453
|
+
0, 0] # enums/sets
|
2454
|
+
|
2455
|
+
classinfos.each do |entry|
|
2456
|
+
data.push string_table.call(entry[0]) # key
|
2457
|
+
data.push string_table.call(entry[1]) # value
|
2458
|
+
end
|
2459
|
+
|
2460
|
+
signals.each do |entry|
|
2461
|
+
data.push string_table.call(entry.full_name) # signature
|
2462
|
+
data.push string_table.call(entry.full_name.delete("^,")) # parameters
|
2463
|
+
data.push string_table.call(entry.reply_type) # type, "" means void
|
2464
|
+
data.push string_table.call("") # tag
|
2465
|
+
if dbus
|
2466
|
+
data.push MethodScriptable | MethodSignal | AccessPublic
|
2467
|
+
else
|
2468
|
+
data.push MethodSignal | AccessProtected # flags, always protected for now
|
2469
|
+
end
|
2470
|
+
end
|
2471
|
+
|
2472
|
+
slots.each do |entry|
|
2473
|
+
data.push string_table.call(entry.full_name) # signature
|
2474
|
+
data.push string_table.call(entry.full_name.delete("^,")) # parameters
|
2475
|
+
data.push string_table.call(entry.reply_type) # type, "" means void
|
2476
|
+
data.push string_table.call("") # tag
|
2477
|
+
if dbus
|
2478
|
+
data.push MethodScriptable | MethodSlot | AccessPublic # flags, always public for now
|
2479
|
+
else
|
2480
|
+
data.push MethodSlot | AccessPublic # flags, always public for now
|
2481
|
+
end
|
2482
|
+
end
|
2483
|
+
|
2484
|
+
data.push 0 # eod
|
2485
|
+
|
2486
|
+
return [stringdata.pack(pack_string), data]
|
2487
|
+
end
|
2488
|
+
|
2489
|
+
def Internal.getMetaObject(klass, qobject)
|
2490
|
+
if klass.nil?
|
2491
|
+
klass = qobject.class
|
2492
|
+
end
|
2493
|
+
|
2494
|
+
parentMeta = nil
|
2495
|
+
if @@cpp_names[klass.superclass.name].nil?
|
2496
|
+
parentMeta = getMetaObject(klass.superclass, qobject)
|
2497
|
+
end
|
2498
|
+
|
2499
|
+
meta = Meta[klass.name]
|
2500
|
+
if meta.nil?
|
2501
|
+
meta = Qt::MetaInfo.new(klass)
|
2502
|
+
end
|
2503
|
+
|
2504
|
+
if meta.metaobject.nil? or meta.changed
|
2505
|
+
stringdata, data = makeMetaData( qobject.class.name,
|
2506
|
+
meta.classinfos,
|
2507
|
+
meta.dbus,
|
2508
|
+
meta.signals,
|
2509
|
+
meta.slots )
|
2510
|
+
meta.metaobject = make_metaObject(qobject, parentMeta, stringdata, data)
|
2511
|
+
meta.changed = false
|
2512
|
+
end
|
2513
|
+
|
2514
|
+
meta.metaobject
|
2515
|
+
end
|
2516
|
+
|
2517
|
+
def Internal.connect(src, signal, target, block)
|
2518
|
+
args = (signal =~ /\((.*)\)/) ? $1 : ""
|
2519
|
+
signature = Qt::MetaObject.normalizedSignature("invoke(%s)" % args).to_s
|
2520
|
+
return Qt::Object.connect( src,
|
2521
|
+
signal,
|
2522
|
+
Qt::BlockInvocation.new(target, block, signature),
|
2523
|
+
SLOT(signature) )
|
2524
|
+
end
|
2525
|
+
|
2526
|
+
def Internal.signal_connect(src, signal, block)
|
2527
|
+
args = (signal =~ /\((.*)\)/) ? $1 : ""
|
2528
|
+
signature = Qt::MetaObject.normalizedSignature("invoke(%s)" % args).to_s
|
2529
|
+
return Qt::Object.connect( src,
|
2530
|
+
signal,
|
2531
|
+
Qt::SignalBlockInvocation.new(src, block, signature),
|
2532
|
+
SLOT(signature) )
|
2533
|
+
end
|
2534
|
+
end # Qt::Internal
|
2535
|
+
|
2536
|
+
Meta = {}
|
2537
|
+
|
2538
|
+
# An entry for each signal or slot
|
2539
|
+
# Example
|
2540
|
+
# int foobar(QString,bool)
|
2541
|
+
# :name is 'foobar'
|
2542
|
+
# :full_name is 'foobar(QString,bool)'
|
2543
|
+
# :arg_types is 'QString,bool'
|
2544
|
+
# :reply_type is 'int'
|
2545
|
+
QObjectMember = Struct.new :name, :full_name, :arg_types, :reply_type
|
2546
|
+
|
2547
|
+
class MetaInfo
|
2548
|
+
attr_accessor :classinfos, :dbus, :signals, :slots, :metaobject, :mocargs, :changed
|
2549
|
+
|
2550
|
+
def initialize(klass)
|
2551
|
+
Meta[klass.name] = self
|
2552
|
+
@klass = klass
|
2553
|
+
@metaobject = nil
|
2554
|
+
@signals = []
|
2555
|
+
@slots = []
|
2556
|
+
@classinfos = []
|
2557
|
+
@dbus = false
|
2558
|
+
@changed = false
|
2559
|
+
Internal.addMetaObjectMethods(klass)
|
2560
|
+
end
|
2561
|
+
|
2562
|
+
def add_signals(signal_list)
|
2563
|
+
signal_names = []
|
2564
|
+
signal_list.each do |signal|
|
2565
|
+
if signal.kind_of? Symbol
|
2566
|
+
signal = signal.to_s + "()"
|
2567
|
+
end
|
2568
|
+
signal = Qt::MetaObject.normalizedSignature(signal).to_s
|
2569
|
+
if signal =~ /^(([\w,<>:]*)\s+)?([^\s]*)\((.*)\)/
|
2570
|
+
@signals.push QObjectMember.new($3, $3 + "(" + $4 + ")", $4, ($2 == 'void' || $2.nil?) ? "" : $2)
|
2571
|
+
signal_names << $3
|
2572
|
+
else
|
2573
|
+
qWarning( "#{@klass.name}: Invalid signal format: '#{signal}'" )
|
2574
|
+
end
|
2575
|
+
end
|
2576
|
+
Internal.addSignalMethods(@klass, signal_names)
|
2577
|
+
end
|
2578
|
+
|
2579
|
+
# Return a list of signals, including inherited ones
|
2580
|
+
def get_signals
|
2581
|
+
all_signals = []
|
2582
|
+
current = @klass
|
2583
|
+
while current != Qt::Base
|
2584
|
+
meta = Meta[current.name]
|
2585
|
+
if !meta.nil?
|
2586
|
+
all_signals.concat meta.signals
|
2587
|
+
end
|
2588
|
+
current = current.superclass
|
2589
|
+
end
|
2590
|
+
return all_signals
|
2591
|
+
end
|
2592
|
+
|
2593
|
+
def add_slots(slot_list)
|
2594
|
+
slot_list.each do |slot|
|
2595
|
+
if slot.kind_of? Symbol
|
2596
|
+
slot = slot.to_s + "()"
|
2597
|
+
end
|
2598
|
+
slot = Qt::MetaObject.normalizedSignature(slot).to_s
|
2599
|
+
if slot =~ /^(([\w,<>:]*)\s+)?([^\s]*)\((.*)\)/
|
2600
|
+
@slots.push QObjectMember.new($3, $3 + "(" + $4 + ")", $4, ($2 == 'void' || $2.nil?) ? "" : $2)
|
2601
|
+
else
|
2602
|
+
qWarning( "#{@klass.name}: Invalid slot format: '#{slot}'" )
|
2603
|
+
end
|
2604
|
+
end
|
2605
|
+
end
|
2606
|
+
|
2607
|
+
def add_classinfo(key, value)
|
2608
|
+
@classinfos.push [key, value]
|
2609
|
+
if key == 'D-Bus Interface'
|
2610
|
+
@dbus = true
|
2611
|
+
end
|
2612
|
+
end
|
2613
|
+
end # Qt::MetaInfo
|
2614
|
+
|
2615
|
+
# These values are from the enum WindowType in qnamespace.h.
|
2616
|
+
# Some of the names such as 'Qt::Dialog', clash with QtRuby
|
2617
|
+
# class names. So add some constants here to use instead,
|
2618
|
+
# renamed with an ending of 'Type'.
|
2619
|
+
WidgetType = 0x00000000
|
2620
|
+
WindowType = 0x00000001
|
2621
|
+
DialogType = 0x00000002 | WindowType
|
2622
|
+
SheetType = 0x00000004 | WindowType
|
2623
|
+
DrawerType = 0x00000006 | WindowType
|
2624
|
+
PopupType = 0x00000008 | WindowType
|
2625
|
+
ToolType = 0x0000000a | WindowType
|
2626
|
+
ToolTipType = 0x0000000c | WindowType
|
2627
|
+
SplashScreenType = 0x0000000e | WindowType
|
2628
|
+
DesktopType = 0x00000010 | WindowType
|
2629
|
+
SubWindowType = 0x00000012
|
2630
|
+
|
2631
|
+
end # Qt
|
2632
|
+
|
2633
|
+
class Object
|
2634
|
+
def SIGNAL(signal)
|
2635
|
+
if signal.kind_of? Symbol
|
2636
|
+
return "2" + signal.to_s + "()"
|
2637
|
+
else
|
2638
|
+
return "2" + signal
|
2639
|
+
end
|
2640
|
+
end
|
2641
|
+
|
2642
|
+
def SLOT(slot)
|
2643
|
+
if slot.kind_of? Symbol
|
2644
|
+
return "1" + slot.to_s + "()"
|
2645
|
+
else
|
2646
|
+
return "1" + slot
|
2647
|
+
end
|
2648
|
+
end
|
2649
|
+
|
2650
|
+
def emit(signal)
|
2651
|
+
return signal
|
2652
|
+
end
|
2653
|
+
|
2654
|
+
def QT_TR_NOOP(x) x end
|
2655
|
+
def QT_TRANSLATE_NOOP(scope, x) x end
|
2656
|
+
|
2657
|
+
# See the discussion here: http://eigenclass.org/hiki.rb?instance_exec
|
2658
|
+
# about implementations of the ruby 1.9 method instance_exec(). This
|
2659
|
+
# version is the one from Rails. It isn't thread safe, but that doesn't
|
2660
|
+
# matter for the intended use in invoking blocks as Qt slots.
|
2661
|
+
def instance_exec(*arguments, &block)
|
2662
|
+
block.bind(self)[*arguments]
|
2663
|
+
end
|
2664
|
+
end
|
2665
|
+
|
2666
|
+
class Proc
|
2667
|
+
# Part of the Rails Object#instance_exec implementation
|
2668
|
+
def bind(object)
|
2669
|
+
block, time = self, Time.now
|
2670
|
+
(class << object; self end).class_eval do
|
2671
|
+
method_name = "__bind_#{time.to_i}_#{time.usec}"
|
2672
|
+
define_method(method_name, &block)
|
2673
|
+
method = instance_method(method_name)
|
2674
|
+
remove_method(method_name)
|
2675
|
+
method
|
2676
|
+
end.bind(object)
|
2677
|
+
end
|
2678
|
+
end
|
2679
|
+
|
2680
|
+
class Module
|
2681
|
+
alias_method :_constants, :constants
|
2682
|
+
alias_method :_instance_methods, :instance_methods
|
2683
|
+
alias_method :_protected_instance_methods, :protected_instance_methods
|
2684
|
+
alias_method :_public_instance_methods, :public_instance_methods
|
2685
|
+
|
2686
|
+
private :_constants, :_instance_methods
|
2687
|
+
private :_protected_instance_methods, :_public_instance_methods
|
2688
|
+
|
2689
|
+
def constants
|
2690
|
+
qt_methods(_constants, 0x10, true)
|
2691
|
+
end
|
2692
|
+
|
2693
|
+
def instance_methods(inc_super=true)
|
2694
|
+
qt_methods(_instance_methods(inc_super), 0x0, inc_super)
|
2695
|
+
end
|
2696
|
+
|
2697
|
+
def protected_instance_methods(inc_super=true)
|
2698
|
+
qt_methods(_protected_instance_methods(inc_super), 0x80, inc_super)
|
2699
|
+
end
|
2700
|
+
|
2701
|
+
def public_instance_methods(inc_super=true)
|
2702
|
+
qt_methods(_public_instance_methods(inc_super), 0x0, inc_super)
|
2703
|
+
end
|
2704
|
+
|
2705
|
+
private
|
2706
|
+
def qt_methods(meths, flags, inc_super=true)
|
2707
|
+
if !self.kind_of? Class
|
2708
|
+
return meths
|
2709
|
+
end
|
2710
|
+
|
2711
|
+
klass = self
|
2712
|
+
classid = 0
|
2713
|
+
loop do
|
2714
|
+
classid = Qt::Internal::find_pclassid(klass.name)
|
2715
|
+
break if classid > 0
|
2716
|
+
|
2717
|
+
klass = klass.superclass
|
2718
|
+
if klass.nil?
|
2719
|
+
return meths
|
2720
|
+
end
|
2721
|
+
end
|
2722
|
+
|
2723
|
+
# These methods are all defined in Qt::Base, even if they aren't supported by a particular
|
2724
|
+
# subclass, so remove them to avoid confusion
|
2725
|
+
meths -= ["%", "&", "*", "**", "+", "-", "-@", "/", "<", "<<", "<=", ">", ">=", ">>", "|", "~", "^"]
|
2726
|
+
ids = []
|
2727
|
+
if inc_super
|
2728
|
+
Qt::Internal::getAllParents(classid, ids)
|
2729
|
+
end
|
2730
|
+
ids << classid
|
2731
|
+
ids.each { |c| Qt::Internal::findAllMethodNames(meths, c, flags) }
|
2732
|
+
return meths.uniq
|
2733
|
+
end
|
2734
|
+
end
|