qtbindings 4.8.6.1-x64-mingw32

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.
Files changed (495) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.txt +48 -0
  3. data/COPYING.LIB.txt +510 -0
  4. data/COPYING.txt +286 -0
  5. data/KNOWN_ISSUES.txt +17 -0
  6. data/Rakefile +121 -0
  7. data/TODO.txt +2 -0
  8. data/bin/2.0/rbrcc.exe +0 -0
  9. data/bin/2.0/rbuic4.exe +0 -0
  10. data/bin/2.0/smokeapi.exe +0 -0
  11. data/bin/2.0/smokedeptool.exe +0 -0
  12. data/bin/2.1/rbrcc.exe +0 -0
  13. data/bin/2.1/rbuic4.exe +0 -0
  14. data/bin/2.1/smokeapi.exe +0 -0
  15. data/bin/2.1/smokedeptool.exe +0 -0
  16. data/bin/2.2/rbrcc.exe +0 -0
  17. data/bin/2.2/rbuic4.exe +0 -0
  18. data/bin/2.2/smokeapi.exe +0 -0
  19. data/bin/2.2/smokedeptool.exe +0 -0
  20. data/bin/rbqtapi +152 -0
  21. data/bin/rbrcc +14 -0
  22. data/bin/rbuic4 +14 -0
  23. data/bin/smokeapi +14 -0
  24. data/bin/smokedeptool +14 -0
  25. data/examples/designer/calculatorbuilder/calculatorbuilder.qrc +5 -0
  26. data/examples/designer/calculatorbuilder/calculatorform.rb +60 -0
  27. data/examples/designer/calculatorbuilder/calculatorform.ui +299 -0
  28. data/examples/designer/calculatorbuilder/main.rb +34 -0
  29. data/examples/designer/calculatorbuilder/makefile +2 -0
  30. data/examples/designer/calculatorform/calculatorform.rb +46 -0
  31. data/examples/designer/calculatorform/calculatorform.ui +277 -0
  32. data/examples/designer/calculatorform/main.rb +32 -0
  33. data/examples/designer/calculatorform/makefile +3 -0
  34. data/examples/desktop/screenshot/main.rb +32 -0
  35. data/examples/desktop/screenshot/screenshot.rb +157 -0
  36. data/examples/desktop/systray/images/bad.svg +64 -0
  37. data/examples/desktop/systray/images/heart.svg +55 -0
  38. data/examples/desktop/systray/images/trash.svg +58 -0
  39. data/examples/desktop/systray/main.rb +41 -0
  40. data/examples/desktop/systray/makefile +2 -0
  41. data/examples/desktop/systray/systray.qrc +7 -0
  42. data/examples/desktop/systray/window.rb +219 -0
  43. data/examples/dialogs/complexwizard/complexwizard.rb +140 -0
  44. data/examples/dialogs/complexwizard/licensewizard.rb +294 -0
  45. data/examples/dialogs/complexwizard/main.rb +31 -0
  46. data/examples/dialogs/configdialog/configdialog.rb +109 -0
  47. data/examples/dialogs/configdialog/images/config.png +0 -0
  48. data/examples/dialogs/configdialog/images/query.png +0 -0
  49. data/examples/dialogs/configdialog/images/update.png +0 -0
  50. data/examples/dialogs/configdialog/main.rb +31 -0
  51. data/examples/dialogs/configdialog/pages.rb +140 -0
  52. data/examples/dialogs/extension/finddialog.rb +89 -0
  53. data/examples/dialogs/extension/main.rb +31 -0
  54. data/examples/dialogs/findfiles/main.rb +32 -0
  55. data/examples/dialogs/findfiles/window.rb +177 -0
  56. data/examples/dialogs/simplewizard/classwizard.rb +374 -0
  57. data/examples/dialogs/simplewizard/main.rb +31 -0
  58. data/examples/dialogs/simplewizard/simplewizard.rb +110 -0
  59. data/examples/dialogs/standarddialogs/dialog.rb +340 -0
  60. data/examples/dialogs/standarddialogs/main.rb +31 -0
  61. data/examples/dialogs/tabdialog/main.rb +38 -0
  62. data/examples/dialogs/tabdialog/tabdialog.rb +178 -0
  63. data/examples/draganddrop/draggableicons/dragwidget.rb +125 -0
  64. data/examples/draganddrop/draggableicons/images/boat.png +0 -0
  65. data/examples/draganddrop/draggableicons/images/car.png +0 -0
  66. data/examples/draganddrop/draggableicons/images/house.png +0 -0
  67. data/examples/draganddrop/draggableicons/main.rb +41 -0
  68. data/examples/draganddrop/draggabletext/draglabel.rb +51 -0
  69. data/examples/draganddrop/draggabletext/dragwidget.rb +94 -0
  70. data/examples/draganddrop/draggabletext/main.rb +33 -0
  71. data/examples/draganddrop/draggabletext/words.txt +41 -0
  72. data/examples/draganddrop/dropsite/dropsitewidget.rb +99 -0
  73. data/examples/draganddrop/dropsite/dropsitewindow.rb +114 -0
  74. data/examples/draganddrop/dropsite/main.rb +33 -0
  75. data/examples/draganddrop/fridgemagnets/draglabel.rb +78 -0
  76. data/examples/draganddrop/fridgemagnets/dragwidget.rb +130 -0
  77. data/examples/draganddrop/fridgemagnets/main.rb +33 -0
  78. data/examples/draganddrop/fridgemagnets/words.txt +48 -0
  79. data/examples/draganddrop/puzzle/example.jpg +0 -0
  80. data/examples/draganddrop/puzzle/main.rb +33 -0
  81. data/examples/draganddrop/puzzle/mainwindow.rb +136 -0
  82. data/examples/draganddrop/puzzle/pieceslist.rb +95 -0
  83. data/examples/draganddrop/puzzle/puzzlewidget.rb +190 -0
  84. data/examples/graphicsview/collidingmice/images/cheese.jpg +0 -0
  85. data/examples/graphicsview/collidingmice/main.rb +53 -0
  86. data/examples/graphicsview/collidingmice/makefile +2 -0
  87. data/examples/graphicsview/collidingmice/mice.qrc +5 -0
  88. data/examples/graphicsview/collidingmice/mouse.rb +176 -0
  89. data/examples/graphicsview/dragdroprobot/coloritem.rb +86 -0
  90. data/examples/graphicsview/dragdroprobot/images/head.png +0 -0
  91. data/examples/graphicsview/dragdroprobot/main.rb +57 -0
  92. data/examples/graphicsview/dragdroprobot/makefile +2 -0
  93. data/examples/graphicsview/dragdroprobot/robot.qrc +5 -0
  94. data/examples/graphicsview/dragdroprobot/robot.rb +246 -0
  95. data/examples/itemviews/chart/chart.qrc +5 -0
  96. data/examples/itemviews/chart/main.rb +33 -0
  97. data/examples/itemviews/chart/mainwindow.rb +151 -0
  98. data/examples/itemviews/chart/makefile +2 -0
  99. data/examples/itemviews/chart/mydata.cht +8 -0
  100. data/examples/itemviews/chart/pieview.rb +516 -0
  101. data/examples/itemviews/chart/qtdata.cht +14 -0
  102. data/examples/itemviews/dirview/main.rb +39 -0
  103. data/examples/itemviews/pixelator/imagemodel.rb +51 -0
  104. data/examples/itemviews/pixelator/images.qrc +5 -0
  105. data/examples/itemviews/pixelator/images/qt.png +0 -0
  106. data/examples/itemviews/pixelator/main.rb +34 -0
  107. data/examples/itemviews/pixelator/mainwindow.rb +218 -0
  108. data/examples/itemviews/pixelator/makefile +3 -0
  109. data/examples/itemviews/pixelator/pixeldelegate.rb +67 -0
  110. data/examples/itemviews/puzzle/example.jpg +0 -0
  111. data/examples/itemviews/puzzle/main.rb +36 -0
  112. data/examples/itemviews/puzzle/mainwindow.rb +143 -0
  113. data/examples/itemviews/puzzle/piecesmodel.rb +174 -0
  114. data/examples/itemviews/puzzle/puzzlewidget.rb +192 -0
  115. data/examples/itemviews/simpledommodel/domitem.rb +62 -0
  116. data/examples/itemviews/simpledommodel/dommodel.rb +139 -0
  117. data/examples/itemviews/simpledommodel/main.rb +33 -0
  118. data/examples/itemviews/simpledommodel/mainwindow.rb +66 -0
  119. data/examples/itemviews/simpletreemodel/default.txt +40 -0
  120. data/examples/itemviews/simpletreemodel/main.rb +41 -0
  121. data/examples/itemviews/simpletreemodel/makefile +2 -0
  122. data/examples/itemviews/simpletreemodel/simpletreemodel.qrc +5 -0
  123. data/examples/itemviews/simpletreemodel/treeitem.rb +67 -0
  124. data/examples/itemviews/simpletreemodel/treemodel.rb +164 -0
  125. data/examples/itemviews/sortingmodel/default.txt +40 -0
  126. data/examples/itemviews/sortingmodel/main.rb +53 -0
  127. data/examples/itemviews/sortingmodel/treeitem.rb +73 -0
  128. data/examples/itemviews/sortingmodel/treemodel.rb +166 -0
  129. data/examples/itemviews/spinboxdelegate/main.rb +47 -0
  130. data/examples/itemviews/spinboxdelegate/spinboxdelegate.rb +62 -0
  131. data/examples/killerfilter/killerfilter.rb +55 -0
  132. data/examples/layouts/basiclayouts/dialog.rb +110 -0
  133. data/examples/layouts/basiclayouts/main.rb +31 -0
  134. data/examples/layouts/borderlayout/borderlayout.rb +190 -0
  135. data/examples/layouts/borderlayout/main.rb +32 -0
  136. data/examples/layouts/borderlayout/window.rb +52 -0
  137. data/examples/layouts/flowlayouts/flowlayout.rb +108 -0
  138. data/examples/layouts/flowlayouts/main.rb +32 -0
  139. data/examples/layouts/flowlayouts/window.rb +43 -0
  140. data/examples/mainwindows/application/images/copy.png +0 -0
  141. data/examples/mainwindows/application/images/cut.png +0 -0
  142. data/examples/mainwindows/application/images/new.png +0 -0
  143. data/examples/mainwindows/application/images/open.png +0 -0
  144. data/examples/mainwindows/application/images/paste.png +0 -0
  145. data/examples/mainwindows/application/images/save.png +0 -0
  146. data/examples/mainwindows/application/main.rb +32 -0
  147. data/examples/mainwindows/application/mainwindow.rb +285 -0
  148. data/examples/mainwindows/dockwidgets/images/new.png +0 -0
  149. data/examples/mainwindows/dockwidgets/images/print.png +0 -0
  150. data/examples/mainwindows/dockwidgets/images/save.png +0 -0
  151. data/examples/mainwindows/dockwidgets/images/undo.png +0 -0
  152. data/examples/mainwindows/dockwidgets/main.rb +32 -0
  153. data/examples/mainwindows/dockwidgets/mainwindow.rb +302 -0
  154. data/examples/mainwindows/mdi/images/copy.png +0 -0
  155. data/examples/mainwindows/mdi/images/cut.png +0 -0
  156. data/examples/mainwindows/mdi/images/new.png +0 -0
  157. data/examples/mainwindows/mdi/images/open.png +0 -0
  158. data/examples/mainwindows/mdi/images/paste.png +0 -0
  159. data/examples/mainwindows/mdi/images/save.png +0 -0
  160. data/examples/mainwindows/mdi/main.rb +32 -0
  161. data/examples/mainwindows/mdi/mainwindow.rb +363 -0
  162. data/examples/mainwindows/mdi/mdichild.rb +152 -0
  163. data/examples/mainwindows/menus/main.rb +32 -0
  164. data/examples/mainwindows/menus/mainwindow.rb +327 -0
  165. data/examples/mainwindows/recentfiles/main.rb +32 -0
  166. data/examples/mainwindows/recentfiles/mainwindow.rb +258 -0
  167. data/examples/mainwindows/sdi/images/copy.png +0 -0
  168. data/examples/mainwindows/sdi/images/cut.png +0 -0
  169. data/examples/mainwindows/sdi/images/new.png +0 -0
  170. data/examples/mainwindows/sdi/images/open.png +0 -0
  171. data/examples/mainwindows/sdi/images/paste.png +0 -0
  172. data/examples/mainwindows/sdi/images/save.png +0 -0
  173. data/examples/mainwindows/sdi/main.rb +32 -0
  174. data/examples/mainwindows/sdi/mainwindow.rb +335 -0
  175. data/examples/network/broadcastreceiver/main.rb +32 -0
  176. data/examples/network/broadcastreceiver/receiver.rb +64 -0
  177. data/examples/network/broadcastsender/main.rb +32 -0
  178. data/examples/network/broadcastsender/sender.rb +72 -0
  179. data/examples/network/fortuneclient/client.rb +149 -0
  180. data/examples/network/fortuneclient/main.rb +32 -0
  181. data/examples/network/fortuneserver/main.rb +32 -0
  182. data/examples/network/fortuneserver/server.rb +88 -0
  183. data/examples/network/ftp/ftpwindow.rb +259 -0
  184. data/examples/network/ftp/images/cdtoparent.png +0 -0
  185. data/examples/network/ftp/images/dir.png +0 -0
  186. data/examples/network/ftp/images/file.png +0 -0
  187. data/examples/network/ftp/main.rb +32 -0
  188. data/examples/network/http/httpwindow.rb +187 -0
  189. data/examples/network/http/main.rb +32 -0
  190. data/examples/network/loopback/dialog.rb +163 -0
  191. data/examples/network/loopback/main.rb +32 -0
  192. data/examples/opengl/grabber/glwidget.rb +265 -0
  193. data/examples/opengl/grabber/main.rb +32 -0
  194. data/examples/opengl/grabber/mainwindow.rb +189 -0
  195. data/examples/opengl/hellogl/glwidget.rb +226 -0
  196. data/examples/opengl/hellogl/main.rb +32 -0
  197. data/examples/opengl/hellogl/window.rb +66 -0
  198. data/examples/opengl/textures/glwidget.rb +151 -0
  199. data/examples/opengl/textures/images/side1.png +0 -0
  200. data/examples/opengl/textures/images/side2.png +0 -0
  201. data/examples/opengl/textures/images/side3.png +0 -0
  202. data/examples/opengl/textures/images/side4.png +0 -0
  203. data/examples/opengl/textures/images/side5.png +0 -0
  204. data/examples/opengl/textures/images/side6.png +0 -0
  205. data/examples/opengl/textures/main.rb +32 -0
  206. data/examples/opengl/textures/window.rb +77 -0
  207. data/examples/painting/basicdrawing/images/brick.png +0 -0
  208. data/examples/painting/basicdrawing/images/qt-logo.png +0 -0
  209. data/examples/painting/basicdrawing/main.rb +32 -0
  210. data/examples/painting/basicdrawing/renderarea.rb +166 -0
  211. data/examples/painting/basicdrawing/window.rb +215 -0
  212. data/examples/painting/concentriccircles/circlewidget.rb +88 -0
  213. data/examples/painting/concentriccircles/main.rb +32 -0
  214. data/examples/painting/concentriccircles/window.rb +72 -0
  215. data/examples/painting/fontsampler/main.rb +32 -0
  216. data/examples/painting/fontsampler/mainwindow.rb +369 -0
  217. data/examples/painting/fontsampler/mainwindowbase.ui +136 -0
  218. data/examples/painting/fontsampler/makefile +8 -0
  219. data/examples/painting/fontsampler/previewdialog.rb +257 -0
  220. data/examples/painting/fontsampler/previewdialogbase.ui +224 -0
  221. data/examples/painting/fontsampler/previewlabel.rb +43 -0
  222. data/examples/painting/imagecomposition/imagecomposer.rb +152 -0
  223. data/examples/painting/imagecomposition/imagecomposition.qrc +6 -0
  224. data/examples/painting/imagecomposition/images/background.png +0 -0
  225. data/examples/painting/imagecomposition/images/blackrectangle.png +0 -0
  226. data/examples/painting/imagecomposition/images/butterfly.png +0 -0
  227. data/examples/painting/imagecomposition/images/checker.png +0 -0
  228. data/examples/painting/imagecomposition/main.rb +33 -0
  229. data/examples/painting/imagecomposition/makefile +2 -0
  230. data/examples/painting/painterpaths/main.rb +32 -0
  231. data/examples/painting/painterpaths/renderarea.rb +97 -0
  232. data/examples/painting/painterpaths/window.rb +247 -0
  233. data/examples/painting/svgviewer/files/bubbles.svg +212 -0
  234. data/examples/painting/svgviewer/files/cubic.svg +77 -0
  235. data/examples/painting/svgviewer/files/spheres.svg +79 -0
  236. data/examples/painting/svgviewer/main.rb +38 -0
  237. data/examples/painting/svgviewer/mainwindow.rb +99 -0
  238. data/examples/painting/svgviewer/makefile +2 -0
  239. data/examples/painting/svgviewer/svgview.rb +156 -0
  240. data/examples/painting/svgviewer/svgviewer.qrc +6 -0
  241. data/examples/painting/svgviewer/svgwindow.rb +87 -0
  242. data/examples/painting/transformations/main.rb +32 -0
  243. data/examples/painting/transformations/renderarea.rb +127 -0
  244. data/examples/painting/transformations/window.rb +153 -0
  245. data/examples/passivepopup/passivepopup.rb +38 -0
  246. data/examples/qdbus/chat/chat.rb +146 -0
  247. data/examples/qdbus/chat/chat_adaptor.rb +12 -0
  248. data/examples/qdbus/chat/chat_interface.rb +13 -0
  249. data/examples/qdbus/chat/chatmainwindow.ui +184 -0
  250. data/examples/qdbus/chat/chatsetnickname.ui +145 -0
  251. data/examples/qdbus/chat/makefile +8 -0
  252. data/examples/qdbus/complexpingpong/complexping.rb +92 -0
  253. data/examples/qdbus/complexpingpong/complexpong.rb +83 -0
  254. data/examples/qdbus/complexpingpong/ping-common.rb +1 -0
  255. data/examples/qdbus/listnames/listnames.rb +69 -0
  256. data/examples/qdbus/pingpong/ping-common.rb +1 -0
  257. data/examples/qdbus/pingpong/ping.rb +52 -0
  258. data/examples/qdbus/pingpong/pong.rb +55 -0
  259. data/examples/qdbus/remotecontrolledcar/car/car.rb +151 -0
  260. data/examples/qdbus/remotecontrolledcar/car/main.rb +50 -0
  261. data/examples/qdbus/remotecontrolledcar/controller/controller.rb +66 -0
  262. data/examples/qdbus/remotecontrolledcar/controller/controller.ui +61 -0
  263. data/examples/qdbus/remotecontrolledcar/controller/main.rb +32 -0
  264. data/examples/qdbus/remotecontrolledcar/controller/makefile +2 -0
  265. data/examples/qtscribble/scribble.rb +270 -0
  266. data/examples/richtext/calendar/main.rb +33 -0
  267. data/examples/richtext/calendar/mainwindow.rb +173 -0
  268. data/examples/richtext/orderform/detailsdialog.rb +130 -0
  269. data/examples/richtext/orderform/main.rb +34 -0
  270. data/examples/richtext/orderform/mainwindow.rb +194 -0
  271. data/examples/richtext/syntaxhighlighter/examples/example +79 -0
  272. data/examples/richtext/syntaxhighlighter/highlighter.rb +90 -0
  273. data/examples/richtext/syntaxhighlighter/main.rb +34 -0
  274. data/examples/richtext/syntaxhighlighter/mainwindow.rb +105 -0
  275. data/examples/ruboids/LICENSE.txt +58 -0
  276. data/examples/ruboids/Manifest +26 -0
  277. data/examples/ruboids/README +53 -0
  278. data/examples/ruboids/TODO +29 -0
  279. data/examples/ruboids/boids.properties +33 -0
  280. data/examples/ruboids/generateManifest.rb +42 -0
  281. data/examples/ruboids/index.html +147 -0
  282. data/examples/ruboids/release.rb +152 -0
  283. data/examples/ruboids/ruboids/Boid.rb +141 -0
  284. data/examples/ruboids/ruboids/BoidView.rb +159 -0
  285. data/examples/ruboids/ruboids/Camera.rb +24 -0
  286. data/examples/ruboids/ruboids/CameraDialog.rb +218 -0
  287. data/examples/ruboids/ruboids/Canvas.rb +143 -0
  288. data/examples/ruboids/ruboids/Cloud.rb +61 -0
  289. data/examples/ruboids/ruboids/CloudView.rb +54 -0
  290. data/examples/ruboids/ruboids/Flock.rb +47 -0
  291. data/examples/ruboids/ruboids/Graphics.rb +278 -0
  292. data/examples/ruboids/ruboids/Params.rb +87 -0
  293. data/examples/ruboids/ruboids/Point.rb +153 -0
  294. data/examples/ruboids/ruboids/Thing.rb +34 -0
  295. data/examples/ruboids/ruboids/Triangle.rb +21 -0
  296. data/examples/ruboids/ruboids/View.rb +88 -0
  297. data/examples/ruboids/ruboids/World.rb +82 -0
  298. data/examples/ruboids/ruboids/WorldWindow.rb +52 -0
  299. data/examples/ruboids/ruboids/info.rb +12 -0
  300. data/examples/ruboids/ruboids/ruboids.rb +29 -0
  301. data/examples/run_all.rb +15 -0
  302. data/examples/threading/main_thread.rb +19 -0
  303. data/examples/tutorial/t1/t1.rb +10 -0
  304. data/examples/tutorial/t10/cannon.rb +72 -0
  305. data/examples/tutorial/t10/lcdrange.rb +45 -0
  306. data/examples/tutorial/t10/t10.rb +55 -0
  307. data/examples/tutorial/t11/cannon.rb +124 -0
  308. data/examples/tutorial/t11/lcdrange.rb +45 -0
  309. data/examples/tutorial/t11/t11.rb +65 -0
  310. data/examples/tutorial/t12/cannon.rb +158 -0
  311. data/examples/tutorial/t12/lcdrange.rb +59 -0
  312. data/examples/tutorial/t12/t12.rb +66 -0
  313. data/examples/tutorial/t13/cannon.rb +208 -0
  314. data/examples/tutorial/t13/gamebrd.rb +113 -0
  315. data/examples/tutorial/t13/lcdrange.rb +60 -0
  316. data/examples/tutorial/t13/t13.rb +11 -0
  317. data/examples/tutorial/t14/cannon.rb +263 -0
  318. data/examples/tutorial/t14/gamebrd.rb +123 -0
  319. data/examples/tutorial/t14/lcdrange.rb +63 -0
  320. data/examples/tutorial/t14/t14.rb +11 -0
  321. data/examples/tutorial/t2/t2.rb +16 -0
  322. data/examples/tutorial/t3/t3.rb +18 -0
  323. data/examples/tutorial/t4/t4.rb +25 -0
  324. data/examples/tutorial/t5/t5.rb +37 -0
  325. data/examples/tutorial/t6/t6.rb +52 -0
  326. data/examples/tutorial/t7/lcdrange.rb +32 -0
  327. data/examples/tutorial/t7/t7.rb +42 -0
  328. data/examples/tutorial/t8/cannon.rb +38 -0
  329. data/examples/tutorial/t8/lcdrange.rb +45 -0
  330. data/examples/tutorial/t8/t8.rb +43 -0
  331. data/examples/tutorial/t9/cannon.rb +45 -0
  332. data/examples/tutorial/t9/lcdrange.rb +46 -0
  333. data/examples/tutorial/t9/t9.rb +43 -0
  334. data/examples/widgets/analogclock/analogclock.rb +94 -0
  335. data/examples/widgets/analogclock/main.rb +9 -0
  336. data/examples/widgets/calculator/button.rb +45 -0
  337. data/examples/widgets/calculator/calculator.rb +382 -0
  338. data/examples/widgets/calculator/main.rb +32 -0
  339. data/examples/widgets/charactermap/characterwidget.rb +110 -0
  340. data/examples/widgets/charactermap/main.rb +32 -0
  341. data/examples/widgets/charactermap/mainwindow.rb +118 -0
  342. data/examples/widgets/digitalclock/digitalclock.rb +30 -0
  343. data/examples/widgets/digitalclock/main.rb +9 -0
  344. data/examples/widgets/groupbox/main.rb +32 -0
  345. data/examples/widgets/groupbox/window.rb +134 -0
  346. data/examples/widgets/icons/iconpreviewarea.rb +111 -0
  347. data/examples/widgets/icons/iconsizespinbox.rb +39 -0
  348. data/examples/widgets/icons/imagedelegate.rb +73 -0
  349. data/examples/widgets/icons/images/designer.png +0 -0
  350. data/examples/widgets/icons/images/find_disabled.png +0 -0
  351. data/examples/widgets/icons/images/find_normal.png +0 -0
  352. data/examples/widgets/icons/images/monkey_off_128x128.png +0 -0
  353. data/examples/widgets/icons/images/monkey_off_16x16.png +0 -0
  354. data/examples/widgets/icons/images/monkey_off_32x32.png +0 -0
  355. data/examples/widgets/icons/images/monkey_off_64x64.png +0 -0
  356. data/examples/widgets/icons/images/monkey_on_128x128.png +0 -0
  357. data/examples/widgets/icons/images/monkey_on_16x16.png +0 -0
  358. data/examples/widgets/icons/images/monkey_on_32x32.png +0 -0
  359. data/examples/widgets/icons/images/monkey_on_64x64.png +0 -0
  360. data/examples/widgets/icons/images/qtopia_16x16.png +0 -0
  361. data/examples/widgets/icons/images/qtopia_32x32.png +0 -0
  362. data/examples/widgets/icons/images/qtopia_48x48.png +0 -0
  363. data/examples/widgets/icons/main.rb +32 -0
  364. data/examples/widgets/icons/mainwindow.rb +351 -0
  365. data/examples/widgets/imageviewer/imageviewer.rb +219 -0
  366. data/examples/widgets/imageviewer/main.rb +32 -0
  367. data/examples/widgets/lineedits/main.rb +32 -0
  368. data/examples/widgets/lineedits/window.rb +199 -0
  369. data/examples/widgets/movie/images/open.png +0 -0
  370. data/examples/widgets/movie/images/pause.png +0 -0
  371. data/examples/widgets/movie/images/play.png +0 -0
  372. data/examples/widgets/movie/images/quit.png +0 -0
  373. data/examples/widgets/movie/images/stop.png +0 -0
  374. data/examples/widgets/movie/main.rb +32 -0
  375. data/examples/widgets/movie/movieplayer.rb +201 -0
  376. data/examples/widgets/movie/movies/fire.mng +0 -0
  377. data/examples/widgets/screenshot/main.rb +32 -0
  378. data/examples/widgets/screenshot/screenshot.rb +155 -0
  379. data/examples/widgets/scribble/main.rb +32 -0
  380. data/examples/widgets/scribble/mainwindow.rb +202 -0
  381. data/examples/widgets/scribble/scribblearea.rb +154 -0
  382. data/examples/widgets/sliders/main.rb +32 -0
  383. data/examples/widgets/sliders/slidersgroup.rb +97 -0
  384. data/examples/widgets/sliders/window.rb +124 -0
  385. data/examples/widgets/spinboxes/main.rb +32 -0
  386. data/examples/widgets/spinboxes/window.rb +213 -0
  387. data/examples/widgets/tetrix/main.rb +33 -0
  388. data/examples/widgets/tetrix/tetrixboard.rb +346 -0
  389. data/examples/widgets/tetrix/tetrixpiece.rb +135 -0
  390. data/examples/widgets/tetrix/tetrixwindow.rb +88 -0
  391. data/examples/widgets/tooltips/images/circle.png +0 -0
  392. data/examples/widgets/tooltips/images/square.png +0 -0
  393. data/examples/widgets/tooltips/images/triangle.png +0 -0
  394. data/examples/widgets/tooltips/main.rb +32 -0
  395. data/examples/widgets/tooltips/shapeitem.rb +31 -0
  396. data/examples/widgets/tooltips/sortingbox.rb +222 -0
  397. data/examples/widgets/wiggly/dialog.rb +48 -0
  398. data/examples/widgets/wiggly/main.rb +9 -0
  399. data/examples/widgets/wiggly/wigglywidget.rb +76 -0
  400. data/examples/widgets/windowflags/controllerwindow.rb +195 -0
  401. data/examples/widgets/windowflags/main.rb +32 -0
  402. data/examples/widgets/windowflags/previewwindow.rb +103 -0
  403. data/examples/xml/dombookmarks/frank.xbel +230 -0
  404. data/examples/xml/dombookmarks/jennifer.xbel +93 -0
  405. data/examples/xml/dombookmarks/main.rb +34 -0
  406. data/examples/xml/dombookmarks/mainwindow.rb +129 -0
  407. data/examples/xml/dombookmarks/xbeltree.rb +172 -0
  408. data/examples/xml/saxbookmarks/frank.xbel +230 -0
  409. data/examples/xml/saxbookmarks/jennifer.xbel +93 -0
  410. data/examples/xml/saxbookmarks/main.rb +34 -0
  411. data/examples/xml/saxbookmarks/mainwindow.rb +144 -0
  412. data/examples/xml/saxbookmarks/xbelgenerator.rb +95 -0
  413. data/examples/xml/saxbookmarks/xbelhandler.rb +122 -0
  414. data/extconf.rb +256 -0
  415. data/lib/2.0/libqtruby4shared.dll +0 -0
  416. data/lib/2.0/libsmokebase.dll +0 -0
  417. data/lib/2.0/libsmokeqtcore.dll +0 -0
  418. data/lib/2.0/libsmokeqtdeclarative.dll +0 -0
  419. data/lib/2.0/libsmokeqtgui.dll +0 -0
  420. data/lib/2.0/libsmokeqthelp.dll +0 -0
  421. data/lib/2.0/libsmokeqtmultimedia.dll +0 -0
  422. data/lib/2.0/libsmokeqtnetwork.dll +0 -0
  423. data/lib/2.0/libsmokeqtopengl.dll +0 -0
  424. data/lib/2.0/libsmokeqtscript.dll +0 -0
  425. data/lib/2.0/libsmokeqtsql.dll +0 -0
  426. data/lib/2.0/libsmokeqtsvg.dll +0 -0
  427. data/lib/2.0/libsmokeqttest.dll +0 -0
  428. data/lib/2.0/libsmokeqtuitools.dll +0 -0
  429. data/lib/2.0/libsmokeqtwebkit.dll +0 -0
  430. data/lib/2.0/libsmokeqtxml.dll +0 -0
  431. data/lib/2.0/libsmokeqtxmlpatterns.dll +0 -0
  432. data/lib/2.0/qtdeclarative.so +0 -0
  433. data/lib/2.0/qtruby4.so +0 -0
  434. data/lib/2.0/qtscript.so +0 -0
  435. data/lib/2.0/qttest.so +0 -0
  436. data/lib/2.0/qtuitools.so +0 -0
  437. data/lib/2.0/qtwebkit.so +0 -0
  438. data/lib/2.1/libqtruby4shared.dll +0 -0
  439. data/lib/2.1/libsmokebase.dll +0 -0
  440. data/lib/2.1/libsmokeqtcore.dll +0 -0
  441. data/lib/2.1/libsmokeqtdeclarative.dll +0 -0
  442. data/lib/2.1/libsmokeqtgui.dll +0 -0
  443. data/lib/2.1/libsmokeqthelp.dll +0 -0
  444. data/lib/2.1/libsmokeqtmultimedia.dll +0 -0
  445. data/lib/2.1/libsmokeqtnetwork.dll +0 -0
  446. data/lib/2.1/libsmokeqtopengl.dll +0 -0
  447. data/lib/2.1/libsmokeqtscript.dll +0 -0
  448. data/lib/2.1/libsmokeqtsql.dll +0 -0
  449. data/lib/2.1/libsmokeqtsvg.dll +0 -0
  450. data/lib/2.1/libsmokeqttest.dll +0 -0
  451. data/lib/2.1/libsmokeqtuitools.dll +0 -0
  452. data/lib/2.1/libsmokeqtwebkit.dll +0 -0
  453. data/lib/2.1/libsmokeqtxml.dll +0 -0
  454. data/lib/2.1/libsmokeqtxmlpatterns.dll +0 -0
  455. data/lib/2.1/qtdeclarative.so +0 -0
  456. data/lib/2.1/qtruby4.so +0 -0
  457. data/lib/2.1/qtscript.so +0 -0
  458. data/lib/2.1/qttest.so +0 -0
  459. data/lib/2.1/qtuitools.so +0 -0
  460. data/lib/2.1/qtwebkit.so +0 -0
  461. data/lib/2.2/libqtruby4shared.dll +0 -0
  462. data/lib/2.2/libsmokebase.dll +0 -0
  463. data/lib/2.2/libsmokeqtcore.dll +0 -0
  464. data/lib/2.2/libsmokeqtdeclarative.dll +0 -0
  465. data/lib/2.2/libsmokeqtgui.dll +0 -0
  466. data/lib/2.2/libsmokeqthelp.dll +0 -0
  467. data/lib/2.2/libsmokeqtmultimedia.dll +0 -0
  468. data/lib/2.2/libsmokeqtnetwork.dll +0 -0
  469. data/lib/2.2/libsmokeqtopengl.dll +0 -0
  470. data/lib/2.2/libsmokeqtscript.dll +0 -0
  471. data/lib/2.2/libsmokeqtsql.dll +0 -0
  472. data/lib/2.2/libsmokeqtsvg.dll +0 -0
  473. data/lib/2.2/libsmokeqttest.dll +0 -0
  474. data/lib/2.2/libsmokeqtuitools.dll +0 -0
  475. data/lib/2.2/libsmokeqtwebkit.dll +0 -0
  476. data/lib/2.2/libsmokeqtxml.dll +0 -0
  477. data/lib/2.2/libsmokeqtxmlpatterns.dll +0 -0
  478. data/lib/2.2/qtdeclarative.so +0 -0
  479. data/lib/2.2/qtruby4.so +0 -0
  480. data/lib/2.2/qtscript.so +0 -0
  481. data/lib/2.2/qttest.so +0 -0
  482. data/lib/2.2/qtuitools.so +0 -0
  483. data/lib/2.2/qtwebkit.so +0 -0
  484. data/lib/Qt.rb +1 -0
  485. data/lib/Qt/qtruby4.rb +3258 -0
  486. data/lib/Qt4.rb +111 -0
  487. data/lib/qtbindings_version.rb +2 -0
  488. data/lib/qtdeclarative/qtdeclarative.rb +17 -0
  489. data/lib/qtscript/qtscript.rb +40 -0
  490. data/lib/qttest/qttest.rb +166 -0
  491. data/lib/qtuitools/qtuitools.rb +17 -0
  492. data/lib/qtwebkit/qtwebkit.rb +17 -0
  493. data/qtbindings.gemspec +18 -0
  494. data/qtbindingsnative.gemspec +19 -0
  495. metadata +559 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ require 'Qt4'
@@ -0,0 +1,3258 @@
1
+ =begin
2
+ /***************************************************************************
3
+ qtruby.rb - description
4
+ -------------------
5
+ begin : Fri Jul 4 2003
6
+ copyright : (C) 2003-2008 by Richard Dale
7
+ email : richard.j.dale@gmail.com
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 Lesser General Public License as *
14
+ * published by the Free Software Foundation; either version 2 of the *
15
+ * License, or (at your option) any later version. *
16
+ * *
17
+ ***************************************************************************/
18
+ =end
19
+
20
+ module Qt
21
+
22
+ module DebugLevel
23
+ Off, Minimal, High, Extensive = 0, 1, 2, 3
24
+ end
25
+
26
+ module QtDebugChannel
27
+ QTDB_NONE = 0x00
28
+ QTDB_AMBIGUOUS = 0x01
29
+ QTDB_METHOD_MISSING = 0x02
30
+ QTDB_CALLS = 0x04
31
+ QTDB_GC = 0x08
32
+ QTDB_VIRTUAL = 0x10
33
+ QTDB_VERBOSE = 0x20
34
+ QTDB_ALL = QTDB_VERBOSE | QTDB_VIRTUAL | QTDB_GC | QTDB_CALLS | QTDB_METHOD_MISSING | QTDB_AMBIGUOUS
35
+ end
36
+
37
+ @@debug_level = DebugLevel::Off
38
+ def Qt.debug_level=(level)
39
+ @@debug_level = level
40
+ Internal::setDebug Qt::QtDebugChannel::QTDB_ALL if level >= DebugLevel::Extensive
41
+ end
42
+
43
+ def Qt.debug_level
44
+ @@debug_level
45
+ end
46
+
47
+ module Internal
48
+ #
49
+ # From the enum MethodFlags in qt-copy/src/tools/moc/generator.cpp
50
+ #
51
+ AccessPrivate = 0x00
52
+ AccessProtected = 0x01
53
+ AccessPublic = 0x02
54
+ MethodMethod = 0x00
55
+ MethodSignal = 0x04
56
+ MethodSlot = 0x08
57
+ MethodCompatibility = 0x10
58
+ MethodCloned = 0x20
59
+ MethodScriptable = 0x40
60
+ end
61
+
62
+ class Base
63
+ def self.signals(*signal_list)
64
+ meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
65
+ meta.add_signals(signal_list, Internal::MethodSignal | Internal::AccessProtected)
66
+ meta.changed = true
67
+ end
68
+
69
+ def self.slots(*slot_list)
70
+ meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
71
+ meta.add_slots(slot_list, Internal::MethodSlot | Internal::AccessPublic)
72
+ meta.changed = true
73
+ end
74
+
75
+ def self.private_slots(*slot_list)
76
+ meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
77
+ meta.add_slots(slot_list, Internal::MethodSlot | Internal::AccessPrivate)
78
+ meta.changed = true
79
+ end
80
+
81
+ def self.q_signal(signal)
82
+ meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
83
+ meta.add_signals([signal], Internal::MethodSignal | Internal::AccessProtected)
84
+ meta.changed = true
85
+ end
86
+
87
+ def self.q_slot(slot)
88
+ meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
89
+ meta.add_slots([slot], Internal::MethodSlot | Internal::AccessPublic)
90
+ meta.changed = true
91
+ end
92
+
93
+ def self.q_classinfo(key, value)
94
+ meta = Qt::Meta[self.name] || Qt::MetaInfo.new(self)
95
+ meta.add_classinfo(key, value)
96
+ meta.changed = true
97
+ end
98
+
99
+ def **(a)
100
+ return Qt::**(self, a)
101
+ end
102
+ def +(a)
103
+ return Qt::+(self, a)
104
+ end
105
+ def ~(a)
106
+ return Qt::~(self, a)
107
+ end
108
+ def -@()
109
+ return Qt::-(self)
110
+ end
111
+ def -(a)
112
+ return Qt::-(self, a)
113
+ end
114
+ def *(a)
115
+ return Qt::*(self, a)
116
+ end
117
+ def /(a)
118
+ return Qt::/(self, a) #/
119
+ end
120
+ def %(a)
121
+ return Qt::%(self, a)
122
+ end
123
+ def >>(a)
124
+ return Qt::>>(self, a)
125
+ end
126
+ def <<(a)
127
+ return Qt::<<(self, a)
128
+ end
129
+ def &(a)
130
+ return Qt::&(self, a)
131
+ end
132
+ def ^(a)
133
+ return Qt::^(self, a)
134
+ end
135
+ def |(a)
136
+ return Qt::|(self, a)
137
+ end
138
+
139
+ # Module has '<', '<=', '>' and '>=' operator instance methods, so pretend they
140
+ # don't exist by calling method_missing() explicitly
141
+ def <(a)
142
+ begin
143
+ Qt::method_missing(:<, self, a)
144
+ rescue
145
+ super(a)
146
+ end
147
+ end
148
+
149
+ def <=(a)
150
+ begin
151
+ Qt::method_missing(:<=, self, a)
152
+ rescue
153
+ super(a)
154
+ end
155
+ end
156
+
157
+ def >(a)
158
+ begin
159
+ Qt::method_missing(:>, self, a)
160
+ rescue
161
+ super(a)
162
+ end
163
+ end
164
+
165
+ def >=(a)
166
+ begin
167
+ Qt::method_missing(:>=, self, a)
168
+ rescue
169
+ super(a)
170
+ end
171
+ end
172
+
173
+ # Object has a '==' operator instance method, so pretend it
174
+ # don't exist by calling method_missing() explicitly
175
+ def ==(a)
176
+ return false if a.nil?
177
+ begin
178
+ Qt::method_missing(:==, self, a)
179
+ rescue
180
+ super(a)
181
+ end
182
+ end
183
+
184
+ def self.ancestors
185
+ klass = self
186
+ classid = nil
187
+ loop do
188
+ classid = Qt::Internal::find_pclassid(klass.name)
189
+ break if classid.index
190
+
191
+ klass = klass.superclass
192
+ if klass.nil?
193
+ return super
194
+ end
195
+ end
196
+
197
+ klasses = super
198
+ klasses.delete(Qt::Base)
199
+ klasses.delete(self)
200
+ ids = []
201
+ Qt::Internal::getAllParents(classid, ids)
202
+ return [self] + ids.map {|id| Qt::Internal.find_class(Qt::Internal.classid2name(id))} + klasses
203
+ end
204
+
205
+ # Change the behaviors of is_a? and kind_of? (alias of is_a?) to use above self.ancestors method
206
+ # Note: this definition also affects Object#===
207
+ def is_a?(mod)
208
+ super || self.class.ancestors.include?(mod)
209
+ end
210
+ alias :kind_of? :is_a?
211
+
212
+ def methods(regular=true)
213
+ if !regular
214
+ return singleton_methods
215
+ end
216
+
217
+ qt_methods(super, 0x0)
218
+ end
219
+
220
+ def protected_methods(all=true)
221
+ # From smoke.h, Smoke::mf_protected 0x80
222
+ qt_methods(super, 0x80)
223
+ end
224
+
225
+ def public_methods(all=true)
226
+ methods
227
+ end
228
+
229
+ def singleton_methods(all=true)
230
+ # From smoke.h, Smoke::mf_static 0x01
231
+ qt_methods(super, 0x01)
232
+ end
233
+
234
+ private
235
+ def qt_methods(meths, flags)
236
+ ids = []
237
+ # These methods are all defined in Qt::Base, even if they aren't supported by a particular
238
+ # subclass, so remove them to avoid confusion
239
+ meths -= ["%", "&", "*", "**", "+", "-", "-@", "/", "<", "<<", "<=", ">", ">=", ">>", "|", "~", "^"]
240
+ classid = Qt::Internal::idInstance(self)
241
+ Qt::Internal::getAllParents(classid, ids)
242
+ ids << classid
243
+ ids.each { |c| Qt::Internal::findAllMethodNames(meths, c, flags) }
244
+ return meths.uniq
245
+ end
246
+ end # Qt::Base
247
+
248
+ # Provides a mutable numeric class for passing to methods with
249
+ # C++ 'int*' or 'int&' arg types
250
+ class Integer
251
+ attr_accessor :value
252
+ def initialize(n=0) @value = n end
253
+
254
+ def +(n)
255
+ return Integer.new(@value + n.to_i)
256
+ end
257
+ def -(n)
258
+ return Integer.new(@value - n.to_i)
259
+ end
260
+ def *(n)
261
+ return Integer.new(@value * n.to_i)
262
+ end
263
+ def /(n)
264
+ return Integer.new(@value / n.to_i)
265
+ end
266
+ def %(n)
267
+ return Integer.new(@value % n.to_i)
268
+ end
269
+ def **(n)
270
+ return Integer.new(@value ** n.to_i)
271
+ end
272
+
273
+ def |(n)
274
+ return Integer.new(@value | n.to_i)
275
+ end
276
+ def &(n)
277
+ return Integer.new(@value & n.to_i)
278
+ end
279
+ def ^(n)
280
+ return Integer.new(@value ^ n.to_i)
281
+ end
282
+ def <<(n)
283
+ return Integer.new(@value << n.to_i)
284
+ end
285
+ def >>(n)
286
+ return Integer.new(@value >> n.to_i)
287
+ end
288
+ def >(n)
289
+ return @value > n.to_i
290
+ end
291
+ def >=(n)
292
+ return @value >= n.to_i
293
+ end
294
+ def <(n)
295
+ return @value < n.to_i
296
+ end
297
+ def <=(n)
298
+ return @value <= n.to_i
299
+ end
300
+
301
+ def <=>(n)
302
+ if @value < n.to_i
303
+ return -1
304
+ elsif @value > n.to_i
305
+ return 1
306
+ else
307
+ return 0
308
+ end
309
+ end
310
+
311
+ def to_f() return @value.to_f end
312
+ def to_i() return @value.to_i end
313
+ def to_s() return @value.to_s end
314
+
315
+ def coerce(n)
316
+ [n, @value]
317
+ end
318
+ end
319
+
320
+ # If a C++ enum was converted to an ordinary ruby Integer, the
321
+ # name of the type is lost. The enum type name is needed for overloaded
322
+ # method resolution when two methods differ only by an enum type.
323
+ class Enum
324
+ attr_accessor :type, :value
325
+ def initialize(n, enum_type)
326
+ @value = n
327
+ @type = enum_type
328
+ end
329
+
330
+ def +(n)
331
+ return @value + n.to_i
332
+ end
333
+ def -(n)
334
+ return @value - n.to_i
335
+ end
336
+ def *(n)
337
+ return @value * n.to_i
338
+ end
339
+ def /(n)
340
+ return @value / n.to_i
341
+ end
342
+ def %(n)
343
+ return @value % n.to_i
344
+ end
345
+ def **(n)
346
+ return @value ** n.to_i
347
+ end
348
+
349
+ def |(n)
350
+ return Enum.new(@value | n.to_i, @type)
351
+ end
352
+ def &(n)
353
+ return Enum.new(@value & n.to_i, @type)
354
+ end
355
+ def ^(n)
356
+ return Enum.new(@value ^ n.to_i, @type)
357
+ end
358
+ def ~()
359
+ return ~ @value
360
+ end
361
+ def <(n)
362
+ return @value < n.to_i
363
+ end
364
+ def <=(n)
365
+ return @value <= n.to_i
366
+ end
367
+ def >(n)
368
+ return @value > n.to_i
369
+ end
370
+ def >=(n)
371
+ return @value >= n.to_i
372
+ end
373
+ def <<(n)
374
+ return Enum.new(@value << n.to_i, @type)
375
+ end
376
+ def >>(n)
377
+ return Enum.new(@value >> n.to_i, @type)
378
+ end
379
+
380
+ def ==(n) return @value == n.to_i end
381
+ def to_i() return @value end
382
+
383
+ def to_f() return @value.to_f end
384
+ def to_s() return @value.to_s end
385
+
386
+ def coerce(n)
387
+ [n, @value]
388
+ end
389
+
390
+ def inspect
391
+ to_s
392
+ end
393
+
394
+ def pretty_print(pp)
395
+ pp.text "#<%s:0x%8.8x @type=%s, @value=%d>" % [self.class.name, object_id, type, value]
396
+ end
397
+ end
398
+
399
+ # Provides a mutable boolean class for passing to methods with
400
+ # C++ 'bool*' or 'bool&' arg types
401
+ class Boolean
402
+ attr_accessor :value
403
+ def initialize(b=false) @value = b end
404
+ def nil?
405
+ return !@value
406
+ end
407
+ end
408
+
409
+ class AbstractSlider < Qt::Base
410
+ def range=(arg)
411
+ if arg.kind_of? Range
412
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
413
+ else
414
+ return super(arg)
415
+ end
416
+ end
417
+ end
418
+
419
+ class AbstractSocket < Qt::Base
420
+ def abort(*args)
421
+ method_missing(:abort, *args)
422
+ end
423
+ end
424
+
425
+ class AbstractTextDocumentLayout < Qt::Base
426
+ def format(*args)
427
+ method_missing(:format, *args)
428
+ end
429
+ end
430
+
431
+ class AccessibleEvent < Qt::Base
432
+ def type(*args)
433
+ method_missing(:type, *args)
434
+ end
435
+ end
436
+
437
+ class ActionEvent < Qt::Base
438
+ def type(*args)
439
+ method_missing(:type, *args)
440
+ end
441
+ end
442
+
443
+ class Action < Qt::Base
444
+ def setShortcut(arg)
445
+ if arg.kind_of?(String)
446
+ return super(Qt::KeySequence.new(arg))
447
+ else
448
+ return super(arg)
449
+ end
450
+ end
451
+
452
+ def shortcut=(arg)
453
+ setShortcut(arg)
454
+ end
455
+ end
456
+
457
+ class Application < Qt::Base
458
+ attr_reader :thread_fix
459
+
460
+ def initialize(*args)
461
+ if args.length == 1 && args[0].kind_of?(Array)
462
+ super(args.length + 1, [$0] + args[0])
463
+ else
464
+ super(*args)
465
+ end
466
+ $qApp = self
467
+ @thread_fix = RubyThreadFix.new
468
+ end
469
+
470
+ def disable_threading
471
+ @thread_fix.stop if @thread_fix
472
+ @thread_fix = nil
473
+ end
474
+
475
+ # Delete the underlying C++ instance after exec returns
476
+ # Otherwise, rb_gc_call_finalizer_at_exit() can delete
477
+ # stuff that Qt::Application still needs for its cleanup.
478
+ def exec
479
+ result = method_missing(:exec)
480
+ disable_threading()
481
+ self.dispose
482
+ Qt::Internal.application_terminated = true
483
+ result
484
+ end
485
+
486
+ def type(*args)
487
+ method_missing(:type, *args)
488
+ end
489
+
490
+ def self.translate(*args)
491
+ if args[3] and args[3].value == Qt::Application::UnicodeUTF8.value
492
+ return method_missing(:translate,*args).force_encoding('utf-8')
493
+ else
494
+ return method_missing(:translate,*args)
495
+ end
496
+ end
497
+ end
498
+
499
+ class Buffer < Qt::Base
500
+ def open(*args)
501
+ method_missing(:open, *args)
502
+ end
503
+ end
504
+
505
+ class ButtonGroup < Qt::Base
506
+ def id(*args)
507
+ method_missing(:id, *args)
508
+ end
509
+ end
510
+
511
+ class ByteArray < Qt::Base
512
+ def initialize(*args)
513
+ if args.size == 1 && args[0].kind_of?(String)
514
+ super(args[0], args[0].size)
515
+ else
516
+ super
517
+ end
518
+ end
519
+
520
+ def to_s
521
+ return constData()
522
+ end
523
+
524
+ def to_i
525
+ return toInt()
526
+ end
527
+
528
+ def to_f
529
+ return toDouble()
530
+ end
531
+
532
+ def chop(*args)
533
+ method_missing(:chop, *args)
534
+ end
535
+
536
+ def split(*args)
537
+ method_missing(:split, *args)
538
+ end
539
+ end
540
+
541
+ class CheckBox < Qt::Base
542
+ def setShortcut(arg)
543
+ if arg.kind_of?(String)
544
+ return super(Qt::KeySequence.new(arg))
545
+ else
546
+ return super(arg)
547
+ end
548
+ end
549
+
550
+ def shortcut=(arg)
551
+ setShortcut(arg)
552
+ end
553
+ end
554
+
555
+ class ChildEvent < Qt::Base
556
+ def type(*args)
557
+ method_missing(:type, *args)
558
+ end
559
+ end
560
+
561
+ class CloseEvent < Qt::Base
562
+ def type(*args)
563
+ method_missing(:type, *args)
564
+ end
565
+ end
566
+
567
+ class Color < Qt::Base
568
+ def inspect
569
+ str = super
570
+ str.sub(/>$/, " %s>" % name)
571
+ end
572
+
573
+ def pretty_print(pp)
574
+ str = to_s
575
+ pp.text str.sub(/>$/, " %s>" % name)
576
+ end
577
+
578
+ def name(*args)
579
+ method_missing(:name, *args)
580
+ end
581
+ end
582
+
583
+ class Connection < Qt::Base
584
+ def inspect
585
+ str = super
586
+ str.sub(/>$/, " memberName=%s, memberType=%s, object=%s>" %
587
+ [memberName.inspect, memberType == 1 ? "SLOT" : "SIGNAL", object.inspect] )
588
+ end
589
+
590
+ def pretty_print(pp)
591
+ str = to_s
592
+ pp.text str.sub(/>$/, "\n memberName=%s,\n memberType=%s,\n object=%s>" %
593
+ [memberName.inspect, memberType == 1 ? "SLOT" : "SIGNAL", object.inspect] )
594
+ end
595
+ end
596
+
597
+ class ContextMenuEvent < Qt::Base
598
+ def type(*args)
599
+ method_missing(:type, *args)
600
+ end
601
+ end
602
+
603
+ class CoreApplication < Qt::Base
604
+ attr_reader :thread_fix
605
+
606
+ def initialize(*args)
607
+ if args.length == 1 && args[0].kind_of?(Array)
608
+ super(args.length + 1, [$0] + args[0])
609
+ else
610
+ super(*args)
611
+ end
612
+ $qApp = self
613
+ @thread_fix = RubyThreadFix.new
614
+ end
615
+
616
+ def disable_threading
617
+ @thread_fix.stop if @thread_fix
618
+ @thread_fix = nil
619
+ end
620
+
621
+ # Delete the underlying C++ instance after exec returns
622
+ # Otherwise, rb_gc_call_finalizer_at_exit() can delete
623
+ # stuff that Qt::Application still needs for its cleanup.
624
+ def exec
625
+ method_missing(:exec)
626
+ disable_threading()
627
+ self.dispose
628
+ Qt::Internal.application_terminated = true
629
+ end
630
+
631
+ def type(*args)
632
+ method_missing(:type, *args)
633
+ end
634
+
635
+ def exit(*args)
636
+ method_missing(:exit, *args)
637
+ end
638
+
639
+ def self.translate(*args)
640
+ if args[3] and args[3].value == Qt::Application::UnicodeUTF8.value
641
+ return method_missing(:translate,*args).force_encoding('utf-8')
642
+ else
643
+ return method_missing(:translate,*args)
644
+ end
645
+ end
646
+ end
647
+
648
+ class Cursor < Qt::Base
649
+ def inspect
650
+ str = super
651
+ str.sub(/>$/, " shape=%d>" % shape)
652
+ end
653
+
654
+ def pretty_print(pp)
655
+ str = to_s
656
+ pp.text str.sub(/>$/, " shape=%d>" % shape)
657
+ end
658
+ end
659
+
660
+ class CustomEvent < Qt::Base
661
+ def type(*args)
662
+ method_missing(:type, *args)
663
+ end
664
+ end
665
+
666
+ class Date < Qt::Base
667
+ def initialize(*args)
668
+ if args.size == 1 && args[0].class.name == "Date"
669
+ return super(args[0].year, args[0].month, args[0].day)
670
+ else
671
+ return super(*args)
672
+ end
673
+ end
674
+
675
+ def inspect
676
+ str = super
677
+ str.sub(/>$/, " %s>" % toString)
678
+ end
679
+
680
+ def pretty_print(pp)
681
+ str = to_s
682
+ pp.text str.sub(/>$/, " %s>" % toString)
683
+ end
684
+
685
+ def to_date
686
+ ::Date.new! to_julian_day
687
+ end
688
+ end
689
+
690
+ class DateTime < Qt::Base
691
+ def initialize(*args)
692
+ if args.size == 1 && args[0].class.name == "DateTime"
693
+ return super( Qt::Date.new(args[0].year, args[0].month, args[0].day),
694
+ Qt::Time.new(args[0].hour, args[0].min, args[0].sec) )
695
+ elsif args.size == 1 && args[0].class.name == "Time"
696
+ result = super( Qt::Date.new(args[0].year, args[0].month, args[0].day),
697
+ Qt::Time.new(args[0].hour, args[0].min, args[0].sec, args[0].usec / 1000) )
698
+ result.timeSpec = (args[0].utc? ? Qt::UTC : Qt::LocalTime)
699
+ return result
700
+ else
701
+ return super(*args)
702
+ end
703
+ end
704
+
705
+ def to_time
706
+ if timeSpec == Qt::UTC
707
+ return ::Time.utc( date.year, date.month, date.day,
708
+ time.hour, time.minute, time.second, time.msec * 1000 )
709
+ else
710
+ return ::Time.local( date.year, date.month, date.day,
711
+ time.hour, time.minute, time.second, time.msec * 1000 )
712
+ end
713
+ end
714
+
715
+ def inspect
716
+ str = super
717
+ str.sub(/>$/, " %s>" % toString)
718
+ end
719
+
720
+ def pretty_print(pp)
721
+ str = to_s
722
+ pp.text str.sub(/>$/, " %s>" % toString)
723
+ end
724
+ end
725
+
726
+ class DBusArgument < Qt::Base
727
+ def inspect
728
+ str = super
729
+ str.sub(/>$/, " currentSignature='%s', atEnd=%s>" % [currentSignature, atEnd])
730
+ end
731
+
732
+ def pretty_print(pp)
733
+ str = to_s
734
+ pp.text str.sub(/>$/, " currentSignature='%s, atEnd=%s'>" % [currentSignature, atEnd])
735
+ end
736
+ end
737
+
738
+ class DBusConnection < Qt::Base
739
+ def send(*args)
740
+ method_missing(:send, *args)
741
+ end
742
+ end
743
+
744
+ class DBusConnectionInterface < Qt::Base
745
+ def serviceOwner(name)
746
+ return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "GetNameOwner", [Qt::Variant.new(name)]))
747
+ end
748
+
749
+ def service_owner(name)
750
+ return serviceOwner(name)
751
+ end
752
+
753
+ def registeredServiceNames
754
+ return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "ListNames"))
755
+ end
756
+
757
+ def registered_service_names
758
+ return registeredServiceNames
759
+ end
760
+
761
+ def isServiceRegistered(serviceName)
762
+ return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "NameHasOwner", [Qt::Variant.new(serviceName)]))
763
+ end
764
+
765
+ def is_service_registered(serviceName)
766
+ return isServiceRegistered(serviceName)
767
+ end
768
+
769
+ def serviceRegistered?(serviceName)
770
+ return isServiceRegistered(serviceName)
771
+ end
772
+
773
+ def service_registered?(serviceName)
774
+ return isServiceRegistered(serviceName)
775
+ end
776
+
777
+ def servicePid(serviceName)
778
+ return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "GetConnectionUnixProcessID", [Qt::Variant.new(serviceName)]))
779
+ end
780
+
781
+ def service_pid(serviceName)
782
+ return servicePid(serviceName)
783
+ end
784
+
785
+ def serviceUid(serviceName)
786
+ return Qt::DBusReply.new(internalConstCall(Qt::DBus::AutoDetect, "GetConnectionUnixUser", [Qt::Variant.new(serviceName)]))
787
+ end
788
+
789
+ def service_uid(serviceName)
790
+ return serviceUid(serviceName)
791
+ end
792
+
793
+ def startService(name)
794
+ return call("StartServiceByName", Qt::Variant.new(name), Qt::Variant.new(0)).value
795
+ end
796
+
797
+ def start_service(name)
798
+ startService(name)
799
+ end
800
+ end
801
+
802
+ class DBusError < Qt::Base
803
+ def type(*args)
804
+ method_missing(:type, *args)
805
+ end
806
+ end
807
+
808
+ class DBusInterface < Qt::Base
809
+ def call(method_name, *args)
810
+ if args.length == 0
811
+ return super(method_name)
812
+ elsif method_name.is_a? Qt::Enum
813
+ opt = args.shift
814
+ qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
815
+ return super(method_name, opt, *qdbusArgs)
816
+ else
817
+ # If the method is Qt::DBusInterface.call(), create an Array
818
+ # 'dbusArgs' of Qt::Variants from '*args'
819
+ qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
820
+ return super(method_name, *qdbusArgs)
821
+ end
822
+ end
823
+
824
+ def method_missing(id, *args)
825
+ begin
826
+ # First look for a method in the Smoke runtime
827
+ # If not found, then throw an exception and try dbus.
828
+ super(id, *args)
829
+ rescue
830
+ if args.length == 0
831
+ return call(id.to_s).value
832
+ else
833
+ return call(id.to_s, *args).value
834
+ end
835
+ end
836
+ end
837
+ end
838
+
839
+ class DBusMessage < Qt::Base
840
+ def type(*args)
841
+ method_missing(:type, *args)
842
+ end
843
+
844
+ def value
845
+ if type() == Qt::DBusMessage::ReplyMessage
846
+ reply = arguments()
847
+ if reply.length == 0
848
+ return nil
849
+ elsif reply.length == 1
850
+ return reply[0].value
851
+ else
852
+ return reply.collect {|v| v.value}
853
+ end
854
+ else
855
+ return nil
856
+ end
857
+ end
858
+
859
+ def <<(a)
860
+ if a.kind_of?(Qt::Variant)
861
+ return super(a)
862
+ else
863
+ return super(qVariantFromValue(a))
864
+ end
865
+ end
866
+ end
867
+
868
+ class DBusReply
869
+ def initialize(reply)
870
+ @error = Qt::DBusError.new(reply)
871
+
872
+ if @error.valid?
873
+ @data = Qt::Variant.new
874
+ return
875
+ end
876
+
877
+ if reply.arguments.length >= 1
878
+ @data = reply.arguments[0]
879
+ return
880
+ end
881
+
882
+ # error
883
+ @error = Qt::DBusError.new( Qt::DBusError::InvalidSignature,
884
+ "Unexpected reply signature" )
885
+ @data = Qt::Variant.new # clear it
886
+ end
887
+
888
+ def isValid
889
+ return !@error.isValid
890
+ end
891
+
892
+ def valid?
893
+ return !@error.isValid
894
+ end
895
+
896
+ def value
897
+ return @data.value
898
+ end
899
+
900
+ def error
901
+ return @error
902
+ end
903
+ end
904
+
905
+ class Dial < Qt::Base
906
+ def range=(arg)
907
+ if arg.kind_of? Range
908
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
909
+ else
910
+ return super(arg)
911
+ end
912
+ end
913
+ end
914
+
915
+ class Dialog < Qt::Base
916
+ def exec(*args)
917
+ method_missing(:exec, *args)
918
+ end
919
+ end
920
+
921
+ class Dir < Qt::Base
922
+ Time = Qt::Enum.new(1, "QDir::SortFlag")
923
+ end
924
+
925
+ class DomAttr < Qt::Base
926
+ def name(*args)
927
+ method_missing(:name, *args)
928
+ end
929
+ end
930
+
931
+ class DoubleSpinBox < Qt::Base
932
+ def range=(arg)
933
+ if arg.kind_of? Range
934
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
935
+ else
936
+ return super(arg)
937
+ end
938
+ end
939
+ end
940
+
941
+ class DoubleValidator < Qt::Base
942
+ def range=(arg)
943
+ if arg.kind_of? Range
944
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
945
+ else
946
+ return super(arg)
947
+ end
948
+ end
949
+ end
950
+
951
+ class DomDocumentType < Qt::Base
952
+ def name(*args)
953
+ method_missing(:name, *args)
954
+ end
955
+
956
+ def type(*args)
957
+ method_missing(:type, *args)
958
+ end
959
+ end
960
+
961
+ class DragEnterEvent < Qt::Base
962
+ def type(*args)
963
+ method_missing(:type, *args)
964
+ end
965
+ end
966
+
967
+ class DragLeaveEvent < Qt::Base
968
+ def type(*args)
969
+ method_missing(:type, *args)
970
+ end
971
+ end
972
+
973
+ class DropEvent < Qt::Base
974
+ def format(*args)
975
+ method_missing(:format, *args)
976
+ end
977
+ def type(*args)
978
+ method_missing(:type, *args)
979
+ end
980
+ end
981
+
982
+ class Event < Qt::Base
983
+ def type(*args)
984
+ method_missing(:type, *args)
985
+ end
986
+ end
987
+
988
+ class EventLoop < Qt::Base
989
+ def exec(*args)
990
+ method_missing(:exec, *args)
991
+ end
992
+
993
+ def exit(*args)
994
+ method_missing(:exit, *args)
995
+ end
996
+ end
997
+
998
+ class File < Qt::Base
999
+ def open(*args)
1000
+ method_missing(:open, *args)
1001
+ end
1002
+ end
1003
+
1004
+ class FileOpenEvent < Qt::Base
1005
+ def type(*args)
1006
+ method_missing(:type, *args)
1007
+ end
1008
+ end
1009
+
1010
+ class FileIconProvider < Qt::Base
1011
+ File = Qt::Enum.new(6, "QFileIconProvider::IconType")
1012
+
1013
+ def type(*args)
1014
+ method_missing(:type, *args)
1015
+ end
1016
+ end
1017
+
1018
+ class FocusEvent < Qt::Base
1019
+ def type(*args)
1020
+ method_missing(:type, *args)
1021
+ end
1022
+ end
1023
+
1024
+ class Font < Qt::Base
1025
+ def inspect
1026
+ str = super
1027
+ str.sub(/>$/, " family=%s, pointSize=%d, weight=%d, italic=%s, bold=%s, underline=%s, strikeOut=%s>" %
1028
+ [family.inspect, pointSize, weight, italic, bold, underline, strikeOut])
1029
+ end
1030
+
1031
+ def pretty_print(pp)
1032
+ str = to_s
1033
+ 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>" %
1034
+ [family.inspect, pointSize, weight, italic, bold, underline, strikeOut])
1035
+ end
1036
+ end
1037
+
1038
+ class FontDatabase < Qt::Base
1039
+ Symbol = Qt::Enum.new(30, "QFontDatabase::WritingSystem")
1040
+ end
1041
+
1042
+ class Ftp < Qt::Base
1043
+ def abort(*args)
1044
+ method_missing(:abort, *args)
1045
+ end
1046
+ end
1047
+
1048
+ class GLContext < Qt::Base
1049
+ def format(*args)
1050
+ method_missing(:format, *args)
1051
+ end
1052
+ end
1053
+
1054
+ class GLPixelBuffer < Qt::Base
1055
+ def format(*args)
1056
+ method_missing(:format, *args)
1057
+ end
1058
+ end
1059
+
1060
+ class GLWidget < Qt::Base
1061
+ def format(*args)
1062
+ method_missing(:format, *args)
1063
+ end
1064
+ end
1065
+
1066
+ class GenericArgument < Qt::Base
1067
+ def name(*args)
1068
+ method_missing(:name, *args)
1069
+ end
1070
+ end
1071
+
1072
+ class Gradient < Qt::Base
1073
+ def type(*args)
1074
+ method_missing(:type, *args)
1075
+ end
1076
+ end
1077
+
1078
+ class GraphicsEllipseItem < Qt::Base
1079
+ def type(*args)
1080
+ method_missing(:type, *args)
1081
+ end
1082
+ end
1083
+
1084
+ class GraphicsItem < Qt::Base
1085
+ def type(*args)
1086
+ method_missing(:type, *args)
1087
+ end
1088
+ end
1089
+
1090
+ class GraphicsItemGroup < Qt::Base
1091
+ Type = 10
1092
+
1093
+ def type(*args)
1094
+ method_missing(:type, *args)
1095
+ end
1096
+ end
1097
+
1098
+ class GraphicsLineItem < Qt::Base
1099
+ Type = 6
1100
+ def type(*args)
1101
+ method_missing(:type, *args)
1102
+ end
1103
+ end
1104
+
1105
+ class GraphicsPathItem < Qt::Base
1106
+ Type = 2
1107
+ def type(*args)
1108
+ method_missing(:type, *args)
1109
+ end
1110
+ end
1111
+
1112
+ class GraphicsPixmapItem < Qt::Base
1113
+ def type(*args)
1114
+ method_missing(:type, *args)
1115
+ end
1116
+ end
1117
+
1118
+ class GraphicsPolygonItem < Qt::Base
1119
+ Type = 5
1120
+ def type(*args)
1121
+ method_missing(:type, *args)
1122
+ end
1123
+ end
1124
+
1125
+ class GraphicsProxyWidget < Qt::Base
1126
+ Type = 12
1127
+ def type(*args)
1128
+ method_missing(:type, *args)
1129
+ end
1130
+ end
1131
+
1132
+ class GraphicsRectItem < Qt::Base
1133
+ Type = 3
1134
+ def type(*args)
1135
+ method_missing(:type, *args)
1136
+ end
1137
+ end
1138
+
1139
+ class GraphicsSceneDragDropEvent < Qt::Base
1140
+ def type(*args)
1141
+ method_missing(:type, *args)
1142
+ end
1143
+ end
1144
+
1145
+ class GraphicsSceneMouseEvent < Qt::Base
1146
+ def type(*args)
1147
+ method_missing(:type, *args)
1148
+ end
1149
+ end
1150
+
1151
+ class GraphicsSceneContextMenuEvent < Qt::Base
1152
+ def type(*args)
1153
+ method_missing(:type, *args)
1154
+ end
1155
+ end
1156
+
1157
+ class GraphicsSceneHoverEvent < Qt::Base
1158
+ def type(*args)
1159
+ method_missing(:type, *args)
1160
+ end
1161
+ end
1162
+
1163
+ class GraphicsSceneHelpEvent < Qt::Base
1164
+ def type(*args)
1165
+ method_missing(:type, *args)
1166
+ end
1167
+ end
1168
+
1169
+ class GraphicsSceneWheelEvent < Qt::Base
1170
+ def type(*args)
1171
+ method_missing(:type, *args)
1172
+ end
1173
+ end
1174
+
1175
+ class GraphicsSimpleTextItem < Qt::Base
1176
+ Type = 9
1177
+ def type(*args)
1178
+ method_missing(:type, *args)
1179
+ end
1180
+ end
1181
+
1182
+ class GraphicsSvgItem < Qt::Base
1183
+ Type = 13
1184
+ def type(*args)
1185
+ method_missing(:type, *args)
1186
+ end
1187
+ end
1188
+
1189
+ class GraphicsTextItem < Qt::Base
1190
+ Type = 8
1191
+ def type(*args)
1192
+ method_missing(:type, *args)
1193
+ end
1194
+ end
1195
+
1196
+ class GraphicsWidget < Qt::Base
1197
+ Type = 11
1198
+ def type(*args)
1199
+ method_missing(:type, *args)
1200
+ end
1201
+ end
1202
+
1203
+ class HelpEvent < Qt::Base
1204
+ def type(*args)
1205
+ method_missing(:type, *args)
1206
+ end
1207
+ end
1208
+
1209
+ class HideEvent < Qt::Base
1210
+ def type(*args)
1211
+ method_missing(:type, *args)
1212
+ end
1213
+ end
1214
+
1215
+ class HoverEvent < Qt::Base
1216
+ def type(*args)
1217
+ method_missing(:type, *args)
1218
+ end
1219
+ end
1220
+
1221
+ class Http < Qt::Base
1222
+ def abort(*args)
1223
+ method_missing(:abort, *args)
1224
+ end
1225
+ end
1226
+
1227
+ class HttpRequestHeader < Qt::Base
1228
+ def method(*args)
1229
+ if args.length == 1
1230
+ super(*args)
1231
+ else
1232
+ method_missing(:method, *args)
1233
+ end
1234
+ end
1235
+ end
1236
+
1237
+ class IconDragEvent < Qt::Base
1238
+ def type(*args)
1239
+ method_missing(:type, *args)
1240
+ end
1241
+ end
1242
+
1243
+ class InputEvent < Qt::Base
1244
+ def type(*args)
1245
+ method_missing(:type, *args)
1246
+ end
1247
+ end
1248
+
1249
+ class InputMethodEvent < Qt::Base
1250
+ def type(*args)
1251
+ method_missing(:type, *args)
1252
+ end
1253
+ end
1254
+
1255
+ class IODevice < Qt::Base
1256
+ def open(*args)
1257
+ method_missing(:open, *args)
1258
+ end
1259
+ end
1260
+
1261
+ class Image < Qt::Base
1262
+ def fromImage(image)
1263
+ send("operator=".to_sym, image)
1264
+ end
1265
+
1266
+ def format(*args)
1267
+ method_missing(:format, *args)
1268
+ end
1269
+
1270
+ def load(*args)
1271
+ method_missing(:load, *args)
1272
+ end
1273
+ end
1274
+
1275
+ class ImageIOHandler < Qt::Base
1276
+ def format(*args)
1277
+ method_missing(:format, *args)
1278
+ end
1279
+
1280
+ def name(*args)
1281
+ method_missing(:name, *args)
1282
+ end
1283
+ end
1284
+
1285
+ class ImageReader < Qt::Base
1286
+ def format(*args)
1287
+ method_missing(:format, *args)
1288
+ end
1289
+ end
1290
+
1291
+ class ImageWriter < Qt::Base
1292
+ def format(*args)
1293
+ method_missing(:format, *args)
1294
+ end
1295
+ end
1296
+
1297
+ class IntValidator < Qt::Base
1298
+ def range=(arg)
1299
+ if arg.kind_of? Range
1300
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
1301
+ else
1302
+ return super(arg)
1303
+ end
1304
+ end
1305
+ end
1306
+
1307
+ class ItemSelection < Qt::Base
1308
+ include Enumerable
1309
+
1310
+ def each
1311
+ for i in 0...count
1312
+ yield at(i)
1313
+ end
1314
+ return self
1315
+ end
1316
+
1317
+ def select(*args)
1318
+ method_missing(:select, *args)
1319
+ end
1320
+
1321
+ def split(*args)
1322
+ method_missing(:split, *args)
1323
+ end
1324
+ end
1325
+
1326
+ class ItemSelectionModel < Qt::Base
1327
+ def select(*args)
1328
+ method_missing(:select, *args)
1329
+ end
1330
+ end
1331
+
1332
+ class KeyEvent < Qt::Base
1333
+ def type(*args)
1334
+ method_missing(:type, *args)
1335
+ end
1336
+ end
1337
+
1338
+ class KeySequence < Qt::Base
1339
+ def initialize(*args)
1340
+ if args.length == 1 && args[0].kind_of?(Qt::Enum) && args[0].type == "Qt::Key"
1341
+ return super(args[0].to_i)
1342
+ end
1343
+ return super(*args)
1344
+ end
1345
+
1346
+ def inspect
1347
+ str = super
1348
+ str.sub(/>$/, " %s>" % toString)
1349
+ end
1350
+
1351
+ def pretty_print(pp)
1352
+ str = to_s
1353
+ pp.text str.sub(/>$/, " %s>" % toString)
1354
+ end
1355
+ end
1356
+
1357
+ class LCDNumber < Qt::Base
1358
+ def display(item)
1359
+ method_missing(:display, item)
1360
+ end
1361
+ end
1362
+
1363
+ class Library < Qt::Base
1364
+ def load(*args)
1365
+ method_missing(:load, *args)
1366
+ end
1367
+ end
1368
+
1369
+ class ListWidgetItem < Qt::Base
1370
+ def clone(*args)
1371
+ Qt::ListWidgetItem.new(self)
1372
+ end
1373
+
1374
+ def type(*args)
1375
+ method_missing(:type, *args)
1376
+ end
1377
+
1378
+ def inspect
1379
+ str = super
1380
+ str.sub(/>$/, " text='%s'>" % text)
1381
+ end
1382
+
1383
+ def pretty_print(pp)
1384
+ str = to_s
1385
+ pp.text str.sub(/>$/, " text='%s'>" % text)
1386
+ end
1387
+ end
1388
+
1389
+ class Locale < Qt::Base
1390
+ def name(*args)
1391
+ method_missing(:name, *args)
1392
+ end
1393
+
1394
+ def system(*args)
1395
+ method_missing(:system, *args)
1396
+ end
1397
+ end
1398
+
1399
+ class Menu < Qt::Base
1400
+ def exec(*args)
1401
+ method_missing(:exec, *args)
1402
+ end
1403
+ end
1404
+
1405
+ class MetaClassInfo < Qt::Base
1406
+ def name(*args)
1407
+ method_missing(:name, *args)
1408
+ end
1409
+ end
1410
+
1411
+ class MetaEnum < Qt::Base
1412
+ def name(*args)
1413
+ method_missing(:name, *args)
1414
+ end
1415
+
1416
+ def keyValues()
1417
+ res = []
1418
+ for i in 0...keyCount()
1419
+ if flag?
1420
+ res.push "%s=0x%x" % [key(i), value(i)]
1421
+ else
1422
+ res.push "%s=%d" % [key(i), value(i)]
1423
+ end
1424
+ end
1425
+ return res
1426
+ end
1427
+
1428
+ def inspect
1429
+ str = super
1430
+ str.sub(/>$/, " scope=%s, name=%s, keyValues=Array (%d element(s))>" % [scope, name, keyValues.length])
1431
+ end
1432
+
1433
+ def pretty_print(pp)
1434
+ str = to_s
1435
+ pp.text str.sub(/>$/, " scope=%s, name=%s, keyValues=Array (%d element(s))>" % [scope, name, keyValues.length])
1436
+ end
1437
+ end
1438
+
1439
+ class MetaMethod < Qt::Base
1440
+ # Oops, name clash with the Signal module so hard code
1441
+ # this value rather than get it from the Smoke runtime
1442
+ Method = Qt::Enum.new(0, "QMetaMethod::MethodType")
1443
+ Signal = Qt::Enum.new(1, "QMetaMethod::MethodType")
1444
+ end
1445
+
1446
+ class MetaObject < Qt::Base
1447
+ def method(*args)
1448
+ if args.length == 1 && args[0].kind_of?(Symbol)
1449
+ super(*args)
1450
+ else
1451
+ method_missing(:method, *args)
1452
+ end
1453
+ end
1454
+
1455
+ # Add three methods, 'propertyNames()', 'slotNames()' and 'signalNames()'
1456
+ # from Qt3, as they are very useful when debugging
1457
+
1458
+ def propertyNames(inherits = false)
1459
+ res = []
1460
+ if inherits
1461
+ for p in 0...propertyCount()
1462
+ res.push property(p).name
1463
+ end
1464
+ else
1465
+ for p in propertyOffset()...propertyCount()
1466
+ res.push property(p).name
1467
+ end
1468
+ end
1469
+ return res
1470
+ end
1471
+
1472
+ def slotNames(inherits = false)
1473
+ res = []
1474
+ if inherits
1475
+ for m in 0...methodCount()
1476
+ if method(m).methodType == Qt::MetaMethod::Slot
1477
+ res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
1478
+ method(m).signature]
1479
+ end
1480
+ end
1481
+ else
1482
+ for m in methodOffset()...methodCount()
1483
+ if method(m).methodType == Qt::MetaMethod::Slot
1484
+ res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
1485
+ method(m).signature]
1486
+ end
1487
+ end
1488
+ end
1489
+ return res
1490
+ end
1491
+
1492
+ def signalNames(inherits = false)
1493
+ res = []
1494
+ if inherits
1495
+ for m in 0...methodCount()
1496
+ if method(m).methodType == Qt::MetaMethod::Signal
1497
+ res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
1498
+ method(m).signature]
1499
+ end
1500
+ end
1501
+ else
1502
+ for m in methodOffset()...methodCount()
1503
+ if method(m).methodType == Qt::MetaMethod::Signal
1504
+ res.push "%s %s" % [method(m).typeName == "" ? "void" : method(m).typeName,
1505
+ method(m).signature]
1506
+ end
1507
+ end
1508
+ end
1509
+ return res
1510
+ end
1511
+
1512
+ def enumerators(inherits = false)
1513
+ res = []
1514
+ if inherits
1515
+ for e in 0...enumeratorCount()
1516
+ res.push enumerator(e)
1517
+ end
1518
+ else
1519
+ for e in enumeratorOffset()...enumeratorCount()
1520
+ res.push enumerator(e)
1521
+ end
1522
+ end
1523
+ return res
1524
+ end
1525
+
1526
+ def inspect
1527
+ str = super
1528
+ str.sub!(/>$/, "")
1529
+ str << " className=%s," % className
1530
+ str << " propertyNames=Array (%d element(s))," % propertyNames.length unless propertyNames.length == 0
1531
+ str << " signalNames=Array (%d element(s))," % signalNames.length unless signalNames.length == 0
1532
+ str << " slotNames=Array (%d element(s))," % slotNames.length unless slotNames.length == 0
1533
+ str << " enumerators=Array (%d element(s))," % enumerators.length unless enumerators.length == 0
1534
+ str << " superClass=%s," % superClass.inspect unless superClass == nil
1535
+ str.chop!
1536
+ str << ">"
1537
+ end
1538
+
1539
+ def pretty_print(pp)
1540
+ str = to_s
1541
+ str.sub!(/>$/, "")
1542
+ str << "\n className=%s," % className
1543
+ str << "\n propertyNames=Array (%d element(s))," % propertyNames.length unless propertyNames.length == 0
1544
+ str << "\n signalNames=Array (%d element(s))," % signalNames.length unless signalNames.length == 0
1545
+ str << "\n slotNames=Array (%d element(s))," % slotNames.length unless slotNames.length == 0
1546
+ str << "\n enumerators=Array (%d element(s))," % enumerators.length unless enumerators.length == 0
1547
+ str << "\n superClass=%s," % superClass.inspect unless superClass == nil
1548
+ str << "\n methodCount=%d," % methodCount
1549
+ str << "\n methodOffset=%d," % methodOffset
1550
+ str << "\n propertyCount=%d," % propertyCount
1551
+ str << "\n propertyOffset=%d," % propertyOffset
1552
+ str << "\n enumeratorCount=%d," % enumeratorCount
1553
+ str << "\n enumeratorOffset=%d," % enumeratorOffset
1554
+ str.chop!
1555
+ str << ">"
1556
+ pp.text str
1557
+ end
1558
+ end
1559
+
1560
+ class MetaProperty < Qt::Base
1561
+ def name(*args)
1562
+ method_missing(:name, *args)
1563
+ end
1564
+
1565
+ def type(*args)
1566
+ method_missing(:type, *args)
1567
+ end
1568
+ end
1569
+
1570
+ class MetaType < Qt::Base
1571
+ Float = Qt::Enum.new(135, "QMetaType::Type")
1572
+
1573
+ def load(*args)
1574
+ method_missing(:load, *args)
1575
+ end
1576
+
1577
+ def type(*args)
1578
+ method_missing(:type, *args)
1579
+ end
1580
+ end
1581
+
1582
+ class MouseEvent < Qt::Base
1583
+ def type(*args)
1584
+ method_missing(:type, *args)
1585
+ end
1586
+ end
1587
+
1588
+ class MoveEvent < Qt::Base
1589
+ def type(*args)
1590
+ method_missing(:type, *args)
1591
+ end
1592
+ end
1593
+
1594
+ class Movie < Qt::Base
1595
+ def format(*args)
1596
+ method_missing(:format, *args)
1597
+ end
1598
+ end
1599
+
1600
+ class NetworkProxy < Qt::Base
1601
+ def type(*args)
1602
+ method_missing(:type, *args)
1603
+ end
1604
+ end
1605
+
1606
+ class Object < Qt::Base
1607
+ end
1608
+
1609
+ class PageSetupDialog < Qt::Base
1610
+ def exec(*args)
1611
+ method_missing(:exec, *args)
1612
+ end
1613
+ end
1614
+
1615
+ class PaintEvent < Qt::Base
1616
+ def type(*args)
1617
+ method_missing(:type, *args)
1618
+ end
1619
+ end
1620
+
1621
+ class Picture < Qt::Base
1622
+ def load(*args)
1623
+ method_missing(:load, *args)
1624
+ end
1625
+ end
1626
+
1627
+ class PictureIO < Qt::Base
1628
+ def format(*args)
1629
+ method_missing(:format, *args)
1630
+ end
1631
+ end
1632
+
1633
+ class Pixmap < Qt::Base
1634
+ def load(*args)
1635
+ method_missing(:load, *args)
1636
+ end
1637
+ end
1638
+
1639
+ class PluginLoader < Qt::Base
1640
+ def load(*args)
1641
+ method_missing(:load, *args)
1642
+ end
1643
+ end
1644
+
1645
+ class Point < Qt::Base
1646
+ def inspect
1647
+ str = super
1648
+ str.sub(/>$/, " x=%d, y=%d>" % [self.x, self.y])
1649
+ end
1650
+
1651
+ def pretty_print(pp)
1652
+ str = to_s
1653
+ pp.text str.sub(/>$/, "\n x=%d,\n y=%d>" % [self.x, self.y])
1654
+ end
1655
+ end
1656
+
1657
+ class PointF < Qt::Base
1658
+ def inspect
1659
+ str = super
1660
+ str.sub(/>$/, " x=%f, y=%f>" % [self.x, self.y])
1661
+ end
1662
+
1663
+ def pretty_print(pp)
1664
+ str = to_s
1665
+ pp.text str.sub(/>$/, "\n x=%f,\n y=%f>" % [self.x, self.y])
1666
+ end
1667
+ end
1668
+
1669
+ class Polygon < Qt::Base
1670
+ include Enumerable
1671
+
1672
+ def each
1673
+ for i in 0...count
1674
+ yield point(i)
1675
+ end
1676
+ return self
1677
+ end
1678
+ end
1679
+
1680
+ class PolygonF < Qt::Base
1681
+ include Enumerable
1682
+
1683
+ def each
1684
+ for i in 0...count
1685
+ yield point(i)
1686
+ end
1687
+ return self
1688
+ end
1689
+ end
1690
+
1691
+ class PrintDialog < Qt::Base
1692
+ def exec(*args)
1693
+ method_missing(:exec, *args)
1694
+ end
1695
+ end
1696
+
1697
+ class Process < Qt::Base
1698
+ StandardError = Qt::Enum.new(1, "QProcess::ProcessChannel")
1699
+ end
1700
+
1701
+ class ProgressBar < Qt::Base
1702
+ def range=(arg)
1703
+ if arg.kind_of? Range
1704
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
1705
+ else
1706
+ return super(arg)
1707
+ end
1708
+ end
1709
+ end
1710
+
1711
+ class ProgressDialog < Qt::Base
1712
+ def range=(arg)
1713
+ if arg.kind_of? Range
1714
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
1715
+ else
1716
+ return super(arg)
1717
+ end
1718
+ end
1719
+ end
1720
+
1721
+ class Printer < Qt::Base
1722
+ def abort(*args)
1723
+ method_missing(:abort, *args)
1724
+ end
1725
+ end
1726
+
1727
+ class PushButton < Qt::Base
1728
+ def setShortcut(arg)
1729
+ if arg.kind_of?(String)
1730
+ return super(Qt::KeySequence.new(arg))
1731
+ else
1732
+ return super(arg)
1733
+ end
1734
+ end
1735
+
1736
+ def shortcut=(arg)
1737
+ setShortcut(arg)
1738
+ end
1739
+ end
1740
+
1741
+ class Line < Qt::Base
1742
+ def inspect
1743
+ str = super
1744
+ str.sub(/>$/, " x1=%d, y1=%d, x2=%d, y2=%d>" % [x1, y1, x2, y2])
1745
+ end
1746
+
1747
+ def pretty_print(pp)
1748
+ str = to_s
1749
+ pp.text str.sub(/>$/, "\n x1=%d,\n y1=%d,\n x2=%d,\n y2=%d>" % [x1, y1, x2, y2])
1750
+ end
1751
+ end
1752
+
1753
+ class LineF < Qt::Base
1754
+ def inspect
1755
+ str = super
1756
+ str.sub(/>$/, " x1=%f, y1=%f, x2=%f, y2=%f>" % [x1, y1, x2, y2])
1757
+ end
1758
+
1759
+ def pretty_print(pp)
1760
+ str = to_s
1761
+ pp.text str.sub(/>$/, "\n x1=%f,\n y1=%f,\n x2=%f,\n y2=%f>" % [x1, y1, x2, y2])
1762
+ end
1763
+ end
1764
+
1765
+ class MetaType < Qt::Base
1766
+ def self.type(*args)
1767
+ method_missing(:type, *args)
1768
+ end
1769
+ end
1770
+
1771
+ class ModelIndex < Qt::Base
1772
+ def inspect
1773
+ str = super
1774
+ str.sub(/>$/, " valid?=%s, row=%s, column=%s>" % [valid?, row, column])
1775
+ end
1776
+
1777
+ def pretty_print(pp)
1778
+ str = to_s
1779
+ pp.text str.sub(/>$/, "\n valid?=%s,\n row=%s,\n column=%s>" % [valid?, row, column])
1780
+ end
1781
+ end
1782
+
1783
+ class RadioButton < Qt::Base
1784
+ def setShortcut(arg)
1785
+ if arg.kind_of?(String)
1786
+ return super(Qt::KeySequence.new(arg))
1787
+ else
1788
+ return super(arg)
1789
+ end
1790
+ end
1791
+
1792
+ def shortcut=(arg)
1793
+ setShortcut(arg)
1794
+ end
1795
+ end
1796
+
1797
+ class Rect < Qt::Base
1798
+ def inspect
1799
+ str = super
1800
+ str.sub(/>$/, " x=%d, y=%d, width=%d, height=%d>" % [self.x, self.y, width, height])
1801
+ end
1802
+
1803
+ def pretty_print(pp)
1804
+ str = to_s
1805
+ pp.text str.sub(/>$/, "\n x=%d,\n y=%d,\n width=%d,\n height=%d>" % [self.x, self.y, width, height])
1806
+ end
1807
+ end
1808
+
1809
+ class RectF < Qt::Base
1810
+ def inspect
1811
+ str = super
1812
+ str.sub(/>$/, " x=%f, y=%f, width=%f, height=%f>" % [self.x, self.y, width, height])
1813
+ end
1814
+
1815
+ def pretty_print(pp)
1816
+ str = to_s
1817
+ pp.text str.sub(/>$/, "\n x=%f,\n y=%f,\n width=%f,\n height=%f>" % [self.x, self.y, width, height])
1818
+ end
1819
+ end
1820
+
1821
+ class ResizeEvent < Qt::Base
1822
+ def type(*args)
1823
+ method_missing(:type, *args)
1824
+ end
1825
+ end
1826
+
1827
+ class ScrollBar < Qt::Base
1828
+ def range=(arg)
1829
+ if arg.kind_of? Range
1830
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
1831
+ else
1832
+ return super(arg)
1833
+ end
1834
+ end
1835
+ end
1836
+
1837
+ class Shortcut < Qt::Base
1838
+ def id(*args)
1839
+ method_missing(:id, *args)
1840
+ end
1841
+ end
1842
+
1843
+ class ShortcutEvent < Qt::Base
1844
+ def type(*args)
1845
+ method_missing(:type, *args)
1846
+ end
1847
+ end
1848
+
1849
+ class ShowEvent < Qt::Base
1850
+ def type(*args)
1851
+ method_missing(:type, *args)
1852
+ end
1853
+ end
1854
+
1855
+ class Size < Qt::Base
1856
+ def inspect
1857
+ str = super
1858
+ str.sub(/>$/, " width=%d, height=%d>" % [width, height])
1859
+ end
1860
+
1861
+ def pretty_print(pp)
1862
+ str = to_s
1863
+ pp.text str.sub(/>$/, "\n width=%d,\n height=%d>" % [width, height])
1864
+ end
1865
+ end
1866
+
1867
+ class SizeF < Qt::Base
1868
+ def inspect
1869
+ str = super
1870
+ str.sub(/>$/, " width=%f, height=%f>" % [width, height])
1871
+ end
1872
+
1873
+ def pretty_print(pp)
1874
+ str = to_s
1875
+ pp.text str.sub(/>$/, "\n width=%f,\n height=%f>" % [width, height])
1876
+ end
1877
+ end
1878
+
1879
+ class SizePolicy < Qt::Base
1880
+ def inspect
1881
+ str = super
1882
+ str.sub(/>$/, " horizontalPolicy=%d, verticalPolicy=%d>" % [horizontalPolicy, verticalPolicy])
1883
+ end
1884
+
1885
+ def pretty_print(pp)
1886
+ str = to_s
1887
+ pp.text str.sub(/>$/, "\n horizontalPolicy=%d,\n verticalPolicy=%d>" % [horizontalPolicy, verticalPolicy])
1888
+ end
1889
+ end
1890
+
1891
+ class Slider < Qt::Base
1892
+ def range=(arg)
1893
+ if arg.kind_of? Range
1894
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
1895
+ else
1896
+ return super(arg)
1897
+ end
1898
+ end
1899
+ end
1900
+
1901
+ class SocketNotifier < Qt::Base
1902
+ Exception = Qt::Enum.new(2, "QSocketNotifier::Type")
1903
+
1904
+ def type(*args)
1905
+ method_missing(:type, *args)
1906
+ end
1907
+ end
1908
+
1909
+ class SpinBox < Qt::Base
1910
+ def range=(arg)
1911
+ if arg.kind_of? Range
1912
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
1913
+ else
1914
+ return super(arg)
1915
+ end
1916
+ end
1917
+ end
1918
+
1919
+ class SqlDatabase < Qt::Base
1920
+ def exec(*args)
1921
+ method_missing(:exec, *args)
1922
+ end
1923
+
1924
+ def open(*args)
1925
+ method_missing(:open, *args)
1926
+ end
1927
+ end
1928
+
1929
+ class SqlError < Qt::Base
1930
+ def type(*args)
1931
+ method_missing(:type, *args)
1932
+ end
1933
+ end
1934
+
1935
+ class SqlField < Qt::Base
1936
+ def name(*args)
1937
+ method_missing(:name, *args)
1938
+ end
1939
+
1940
+ def type(*args)
1941
+ method_missing(:type, *args)
1942
+ end
1943
+ end
1944
+
1945
+ class SqlIndex < Qt::Base
1946
+ def name(*args)
1947
+ method_missing(:name, *args)
1948
+ end
1949
+ end
1950
+
1951
+ class SqlQuery < Qt::Base
1952
+ def exec(*args)
1953
+ method_missing(:exec, *args)
1954
+ end
1955
+ end
1956
+
1957
+ class SqlResult < Qt::Base
1958
+ def exec(*args)
1959
+ method_missing(:exec, *args)
1960
+ end
1961
+ end
1962
+
1963
+ class SqlTableModel < Qt::Base
1964
+ def select(*k)
1965
+ method_missing(:select, *k)
1966
+ end
1967
+ end
1968
+
1969
+ class StandardItem < Qt::Base
1970
+ def inspect
1971
+ str = super
1972
+ str.sub(/>$/, " text='%s'>" % [text])
1973
+ end
1974
+
1975
+ def pretty_print(pp)
1976
+ str = to_s
1977
+ pp.text str.sub(/>$/, "\n text='%s'>" % [text])
1978
+ end
1979
+
1980
+ def type(*args)
1981
+ method_missing(:type, *args)
1982
+ end
1983
+
1984
+ def clone
1985
+ Qt::StandardItem.new(self)
1986
+ end
1987
+ end
1988
+
1989
+ class StandardItemModel < Qt::Base
1990
+ def type(*args)
1991
+ method_missing(:type, *args)
1992
+ end
1993
+ end
1994
+
1995
+ class StatusTipEvent < Qt::Base
1996
+ def type(*args)
1997
+ method_missing(:type, *args)
1998
+ end
1999
+ end
2000
+
2001
+ class StyleHintReturn < Qt::Base
2002
+ def type(*args)
2003
+ method_missing(:type, *args)
2004
+ end
2005
+ end
2006
+
2007
+ class StyleOption < Qt::Base
2008
+ def type(*args)
2009
+ method_missing(:type, *args)
2010
+ end
2011
+ end
2012
+
2013
+ class SyntaxHighlighter < Qt::Base
2014
+ def format(*args)
2015
+ method_missing(:format, *args)
2016
+ end
2017
+ end
2018
+
2019
+ class TableWidgetItem < Qt::Base
2020
+ def clone(*args)
2021
+ Qt::TableWidgetItem.new(self)
2022
+ end
2023
+
2024
+ def type(*args)
2025
+ method_missing(:type, *args)
2026
+ end
2027
+
2028
+ def inspect
2029
+ str = super
2030
+ str.sub(/>$/, " text='%s'>" % text)
2031
+ end
2032
+
2033
+ def pretty_print(pp)
2034
+ str = to_s
2035
+ pp.text str.sub(/>$/, " text='%s'>" % text)
2036
+ end
2037
+ end
2038
+
2039
+ class TemporaryFile < Qt::Base
2040
+ def open(*args)
2041
+ method_missing(:open, *args)
2042
+ end
2043
+ end
2044
+
2045
+ class TextCursor < Qt::Base
2046
+ def select(*k)
2047
+ method_missing(:select, *k)
2048
+ end
2049
+ end
2050
+
2051
+ class TextDocument < Qt::Base
2052
+ def clone(*args)
2053
+ method_missing(:clone, *args)
2054
+ end
2055
+
2056
+ def print(*args)
2057
+ method_missing(:print, *args)
2058
+ end
2059
+ end
2060
+
2061
+ class TextFormat < Qt::Base
2062
+ def type(*args)
2063
+ method_missing(:type, *args)
2064
+ end
2065
+ end
2066
+
2067
+ class TextImageFormat < Qt::Base
2068
+ def name(*args)
2069
+ method_missing(:name, *args)
2070
+ end
2071
+ end
2072
+
2073
+ class TextInlineObject < Qt::Base
2074
+ def format(*args)
2075
+ method_missing(:format, *args)
2076
+ end
2077
+ end
2078
+
2079
+ class TextLength < Qt::Base
2080
+ def type(*args)
2081
+ method_missing(:type, *args)
2082
+ end
2083
+ end
2084
+
2085
+ class TextList < Qt::Base
2086
+ def format(*args)
2087
+ method_missing(:format, *args)
2088
+ end
2089
+ end
2090
+
2091
+ class TextObject < Qt::Base
2092
+ def format(*args)
2093
+ method_missing(:format, *args)
2094
+ end
2095
+ end
2096
+
2097
+ class TextTable < Qt::Base
2098
+ def format(*args)
2099
+ method_missing(:format, *args)
2100
+ end
2101
+ end
2102
+
2103
+ class TextTableCell < Qt::Base
2104
+ def format(*args)
2105
+ method_missing(:format, *args)
2106
+ end
2107
+ end
2108
+
2109
+ class Time < Qt::Base
2110
+ def initialize(*args)
2111
+ if args.size == 1 && args[0].class.name == "Time"
2112
+ return super(args[0].hour, args[0].min, args[0].sec)
2113
+ else
2114
+ return super(*args)
2115
+ end
2116
+ end
2117
+
2118
+ def inspect
2119
+ str = super
2120
+ str.sub(/>$/, " %s>" % toString)
2121
+ end
2122
+
2123
+ def pretty_print(pp)
2124
+ str = to_s
2125
+ pp.text str.sub(/>$/, " %s>" % toString)
2126
+ end
2127
+ end
2128
+
2129
+ class Timer < Qt::Base
2130
+ def start(*args)
2131
+ method_missing(:start, *args)
2132
+ end
2133
+ end
2134
+
2135
+ class TimerEvent < Qt::Base
2136
+ def type(*args)
2137
+ method_missing(:type, *args)
2138
+ end
2139
+ end
2140
+
2141
+ class TimeLine < Qt::Base
2142
+ def frameRange=(arg)
2143
+ if arg.kind_of? Range
2144
+ return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
2145
+ else
2146
+ return super(arg)
2147
+ end
2148
+ end
2149
+ end
2150
+
2151
+ class ToolButton < Qt::Base
2152
+ def setShortcut(arg)
2153
+ if arg.kind_of?(String)
2154
+ return super(Qt::KeySequence.new(arg))
2155
+ else
2156
+ return super(arg)
2157
+ end
2158
+ end
2159
+
2160
+ def shortcut=(arg)
2161
+ setShortcut(arg)
2162
+ end
2163
+ end
2164
+
2165
+ class Translator < Qt::Base
2166
+ def load(*args)
2167
+ method_missing(:load, *args)
2168
+ end
2169
+ end
2170
+
2171
+ class TreeWidget < Qt::Base
2172
+ include Enumerable
2173
+
2174
+ def each
2175
+ it = Qt::TreeWidgetItemIterator.new(self)
2176
+ while it.current
2177
+ yield it.current
2178
+ it += 1
2179
+ end
2180
+ end
2181
+ end
2182
+
2183
+ class TreeWidgetItem < Qt::Base
2184
+ include Enumerable
2185
+
2186
+ def initialize(*args)
2187
+ # There is not way to distinguish between the copy constructor
2188
+ # QTreeWidgetItem (const QTreeWidgetItem & other)
2189
+ # and
2190
+ # QTreeWidgetItem (QTreeWidgetItem * parent, const QStringList & strings, int type = Type)
2191
+ # when the latter has a single argument. So force the second variant to be called
2192
+ if args.length == 1 && args[0].kind_of?(Qt::TreeWidgetItem)
2193
+ super(args[0], Qt::TreeWidgetItem::Type)
2194
+ else
2195
+ super(*args)
2196
+ end
2197
+ end
2198
+
2199
+ def inspect
2200
+ str = super
2201
+ str.sub!(/>$/, "")
2202
+ str << " parent=%s," % parent unless parent.nil?
2203
+ for i in 0..(columnCount - 1)
2204
+ str << " text%d='%s'," % [i, self.text(i)]
2205
+ end
2206
+ str.sub!(/,?$/, ">")
2207
+ end
2208
+
2209
+ def pretty_print(pp)
2210
+ str = to_s
2211
+ str.sub!(/>$/, "")
2212
+ str << " parent=%s," % parent unless parent.nil?
2213
+ for i in 0..(columnCount - 1)
2214
+ str << " text%d='%s'," % [i, self.text(i)]
2215
+ end
2216
+ str.sub!(/,?$/, ">")
2217
+ pp.text str
2218
+ end
2219
+
2220
+ def clone(*args)
2221
+ Qt::TreeWidgetItem.new(self)
2222
+ end
2223
+
2224
+ def type(*args)
2225
+ method_missing(:type, *args)
2226
+ end
2227
+
2228
+ def each
2229
+ it = Qt::TreeWidgetItemIterator.new(self)
2230
+ while it.current
2231
+ yield it.current
2232
+ it += 1
2233
+ end
2234
+ end
2235
+ end
2236
+
2237
+ class TreeWidgetItemIterator < Qt::Base
2238
+ def current
2239
+ return send("operator*".to_sym)
2240
+ end
2241
+ end
2242
+
2243
+ class Url < Qt::Base
2244
+ def inspect
2245
+ str = super
2246
+ str.sub(/>$/, " url=%s>" % toString)
2247
+ end
2248
+
2249
+ def pretty_print(pp)
2250
+ str = to_s
2251
+ pp.text str.sub(/>$/, " url=%s>" % toString)
2252
+ end
2253
+ end
2254
+
2255
+ class UrlInfo < Qt::Base
2256
+ def name(*args)
2257
+ method_missing(:name, *args)
2258
+ end
2259
+ end
2260
+
2261
+ class Uuid < Qt::Base
2262
+ Time = Qt::Enum.new(1, "QUuid::Version")
2263
+ end
2264
+
2265
+ class Variant < Qt::Base
2266
+ String = Qt::Enum.new(10, "QVariant::Type")
2267
+ Date = Qt::Enum.new(14, "QVariant::Type")
2268
+ Time = Qt::Enum.new(15, "QVariant::Type")
2269
+ DateTime = Qt::Enum.new(16, "QVariant::Type")
2270
+
2271
+ def initialize(*args)
2272
+ if args.size == 1 && args[0].nil?
2273
+ return super()
2274
+ elsif args.size == 1 && args[0].class.name == "Date"
2275
+ return super(Qt::Date.new(args[0]))
2276
+ elsif args.size == 1 && args[0].class.name == "DateTime"
2277
+ return super(Qt::DateTime.new( Qt::Date.new(args[0].year, args[0].month, args[0].day),
2278
+ Qt::Time.new(args[0].hour, args[0].min, args[0].sec) ) )
2279
+ elsif args.size == 1 && args[0].class.name == "Time"
2280
+ return super(Qt::Time.new(args[0]))
2281
+ elsif args.size == 1 && args[0].class.name == "BigDecimal"
2282
+ return super(args[0].to_f) # we have to make do with a float
2283
+ else
2284
+ return super(*args)
2285
+ end
2286
+ end
2287
+
2288
+ def to_a
2289
+ return toStringList()
2290
+ end
2291
+
2292
+ def to_f
2293
+ return toDouble()
2294
+ end
2295
+
2296
+ def to_i
2297
+ return toInt()
2298
+ end
2299
+
2300
+ def to_int
2301
+ return toInt()
2302
+ end
2303
+
2304
+ def value
2305
+ case type()
2306
+ when Qt::Variant::Invalid
2307
+ return nil
2308
+ when Qt::Variant::Bitmap
2309
+ when Qt::Variant::Bool
2310
+ return toBool
2311
+ when Qt::Variant::Brush
2312
+ return qVariantValue(Qt::Brush, self)
2313
+ when Qt::Variant::ByteArray
2314
+ return toByteArray
2315
+ when Qt::Variant::Char
2316
+ return qVariantValue(Qt::Char, self)
2317
+ when Qt::Variant::Color
2318
+ return qVariantValue(Qt::Color, self)
2319
+ when Qt::Variant::Cursor
2320
+ return qVariantValue(Qt::Cursor, self)
2321
+ when Qt::Variant::Date
2322
+ return toDate
2323
+ when Qt::Variant::DateTime
2324
+ return toDateTime
2325
+ when Qt::Variant::Double
2326
+ return toDouble
2327
+ when Qt::Variant::Font
2328
+ return qVariantValue(Qt::Font, self)
2329
+ when Qt::Variant::Icon
2330
+ return qVariantValue(Qt::Icon, self)
2331
+ when Qt::Variant::Image
2332
+ return qVariantValue(Qt::Image, self)
2333
+ when Qt::Variant::Int
2334
+ return toInt
2335
+ when Qt::Variant::KeySequence
2336
+ return qVariantValue(Qt::KeySequence, self)
2337
+ when Qt::Variant::Line
2338
+ return toLine
2339
+ when Qt::Variant::LineF
2340
+ return toLineF
2341
+ when Qt::Variant::List
2342
+ return toList
2343
+ when Qt::Variant::Locale
2344
+ return qVariantValue(Qt::Locale, self)
2345
+ when Qt::Variant::LongLong
2346
+ return toLongLong
2347
+ when Qt::Variant::Map
2348
+ return toMap
2349
+ when Qt::Variant::Palette
2350
+ return qVariantValue(Qt::Palette, self)
2351
+ when Qt::Variant::Pen
2352
+ return qVariantValue(Qt::Pen, self)
2353
+ when Qt::Variant::Pixmap
2354
+ return qVariantValue(Qt::Pixmap, self)
2355
+ when Qt::Variant::Point
2356
+ return toPoint
2357
+ when Qt::Variant::PointF
2358
+ return toPointF
2359
+ when Qt::Variant::Polygon
2360
+ return qVariantValue(Qt::Polygon, self)
2361
+ when Qt::Variant::Rect
2362
+ return toRect
2363
+ when Qt::Variant::RectF
2364
+ return toRectF
2365
+ when Qt::Variant::RegExp
2366
+ return toRegExp
2367
+ when Qt::Variant::Region
2368
+ return qVariantValue(Qt::Region, self)
2369
+ when Qt::Variant::Size
2370
+ return toSize
2371
+ when Qt::Variant::SizeF
2372
+ return toSizeF
2373
+ when Qt::Variant::SizePolicy
2374
+ return toSizePolicy
2375
+ when Qt::Variant::String
2376
+ return toString
2377
+ when Qt::Variant::StringList
2378
+ return toStringList
2379
+ when Qt::Variant::TextFormat
2380
+ return qVariantValue(Qt::TextFormat, self)
2381
+ when Qt::Variant::TextLength
2382
+ return qVariantValue(Qt::TextLength, self)
2383
+ when Qt::Variant::Time
2384
+ return toTime
2385
+ when Qt::Variant::UInt
2386
+ return toUInt
2387
+ when Qt::Variant::ULongLong
2388
+ return toULongLong
2389
+ when Qt::Variant::Url
2390
+ return toUrl
2391
+ end
2392
+
2393
+ return qVariantValue(nil, self)
2394
+ end
2395
+
2396
+ def inspect
2397
+ str = super
2398
+ str.sub(/>$/, " typeName=%s>" % typeName)
2399
+ end
2400
+
2401
+ def pretty_print(pp)
2402
+ str = to_s
2403
+ pp.text str.sub(/>$/, " typeName=%s>" % typeName)
2404
+ end
2405
+
2406
+ def load(*args)
2407
+ method_missing(:load, *args)
2408
+ end
2409
+
2410
+ def type(*args)
2411
+ method_missing(:type, *args)
2412
+ end
2413
+ end
2414
+
2415
+ class DBusVariant < Variant
2416
+ def initialize(value)
2417
+ if value.kind_of? Qt::Variant
2418
+ super(value)
2419
+ else
2420
+ super(Qt::Variant.new(value))
2421
+ end
2422
+ end
2423
+
2424
+ def setVariant(variant)
2425
+ end
2426
+
2427
+ def variant=(variant)
2428
+ setVariant(variant)
2429
+ end
2430
+
2431
+ def variant()
2432
+ return self
2433
+ end
2434
+ end
2435
+
2436
+ class WhatsThisClickedEvent < Qt::Base
2437
+ def type(*args)
2438
+ method_missing(:type, *args)
2439
+ end
2440
+ end
2441
+
2442
+ class Widget < Qt::Base
2443
+ def raise(*args)
2444
+ method_missing(:raise, *args)
2445
+ end
2446
+ end
2447
+
2448
+ class WindowStateChangeEvent < Qt::Base
2449
+ def type(*args)
2450
+ method_missing(:type, *args)
2451
+ end
2452
+ end
2453
+
2454
+ class XmlAttributes < Qt::Base
2455
+ def type(*args)
2456
+ method_missing(:type, *args)
2457
+ end
2458
+ end
2459
+
2460
+ class SignalBlockInvocation < Qt::Object
2461
+ def initialize(parent, block, signature)
2462
+ super(parent)
2463
+ if metaObject.indexOfSlot(signature) == -1
2464
+ self.class.slots signature
2465
+ end
2466
+ @block = block
2467
+ end
2468
+
2469
+ def invoke(*args)
2470
+ @block.call(*args)
2471
+ end
2472
+ end
2473
+
2474
+ class BlockInvocation < Qt::Object
2475
+ def initialize(target, block, signature)
2476
+ super(target)
2477
+ if metaObject.indexOfSlot(signature) == -1
2478
+ self.class.slots signature
2479
+ end
2480
+ @block = block
2481
+ end
2482
+
2483
+ def invoke(*args)
2484
+ @block.call(*args)
2485
+ end
2486
+ end
2487
+
2488
+ class MethodInvocation < Qt::Object
2489
+ def initialize(target, method, signature)
2490
+ super(target)
2491
+ if metaObject.indexOfSlot(signature) == -1
2492
+ self.class.slots signature
2493
+ end
2494
+ @target = target
2495
+ method = method.intern unless method.is_a?Symbol
2496
+ @method = method
2497
+ end
2498
+
2499
+ def invoke(*args)
2500
+ @target.send @method, *args
2501
+ end
2502
+ end
2503
+
2504
+ module Internal
2505
+ @@classes = {}
2506
+ @@cpp_names = {}
2507
+ @@idclass = []
2508
+
2509
+ @@normalize_procs = []
2510
+
2511
+ class ModuleIndex
2512
+ attr_accessor :index
2513
+
2514
+ def smoke
2515
+ if ! @smoke
2516
+ return 0
2517
+ end
2518
+ return @smoke
2519
+ end
2520
+
2521
+ def initialize(smoke, index)
2522
+ @smoke = smoke
2523
+ @index = index
2524
+ end
2525
+ end
2526
+
2527
+ def self.classes
2528
+ return @@classes
2529
+ end
2530
+
2531
+ def self.cpp_names
2532
+ return @@cpp_names
2533
+ end
2534
+
2535
+ def self.idclass
2536
+ return @@idclass
2537
+ end
2538
+
2539
+ def self.add_normalize_proc(func)
2540
+ @@normalize_procs << func
2541
+ end
2542
+
2543
+ def Internal.normalize_classname(classname)
2544
+ @@normalize_procs.each do |func|
2545
+ ret = func.call(classname)
2546
+ if !ret.nil?
2547
+ return ret
2548
+ end
2549
+ end
2550
+ if classname =~ /^Q3/
2551
+ ruby_classname = classname.sub(/^Q3(?=[A-Z])/,'Qt3::')
2552
+ elsif classname =~ /^Q/
2553
+ ruby_classname = classname.sub(/^Q(?=[A-Z])/,'Qt::')
2554
+ else
2555
+ ruby_classname = classname
2556
+ end
2557
+ ruby_classname
2558
+ end
2559
+
2560
+ def Internal.init_class(c)
2561
+ if c == "WebCore" || c == "std" || c == "QGlobalSpace"
2562
+ return
2563
+ end
2564
+ classname = Qt::Internal::normalize_classname(c)
2565
+ classId = Qt::Internal.findClass(c)
2566
+ insert_pclassid(classname, classId)
2567
+ @@idclass[classId.index] = classname
2568
+ @@cpp_names[classname] = c
2569
+ klass = isQObject(c) ? create_qobject_class(classname, Qt) \
2570
+ : create_qt_class(classname, Qt)
2571
+ @@classes[classname] = klass unless klass.nil?
2572
+ end
2573
+
2574
+ def Internal.debug_level
2575
+ Qt.debug_level
2576
+ end
2577
+
2578
+ def Internal.checkarg(argtype, typename)
2579
+ const_point = typename =~ /^const\s+/ ? -1 : 0
2580
+ if argtype == 'i'
2581
+ if typename =~ /^int&?$|^signed int&?$|^signed$|^qint32&?$/
2582
+ return 6 + const_point
2583
+ elsif typename =~ /^quint32&?$/
2584
+ return 4 + const_point
2585
+ elsif typename =~ /^(?:short|ushort|unsigned short int|unsigned short|uchar|char|unsigned char|uint|long|ulong|unsigned long int|unsigned|float|double|WId|HBITMAP__\*|HDC__\*|HFONT__\*|HICON__\*|HINSTANCE__\*|HPALETTE__\*|HRGN__\*|HWND__\*|Q_PID|^quint16&?$|^qint16&?$)$/
2586
+ return 4 + const_point
2587
+ elsif typename =~ /^(quint|qint|qulong|qlong|qreal)/
2588
+ return 4 + const_point
2589
+ else
2590
+ t = typename.sub(/^const\s+/, '')
2591
+ t.sub!(/[&*]$/, '')
2592
+ if isEnum(t)
2593
+ return 2
2594
+ end
2595
+ end
2596
+ elsif argtype == 'n'
2597
+ if typename =~ /^double$|^qreal$/
2598
+ return 6 + const_point
2599
+ elsif typename =~ /^float$/
2600
+ return 4 + const_point
2601
+ elsif typename =~ /^int&?$/
2602
+ return 2 + const_point
2603
+ elsif typename =~ /^(?:short|ushort|uint|long|ulong|signed|unsigned|float|double)$/
2604
+ return 2 + const_point
2605
+ else
2606
+ t = typename.sub(/^const\s+/, '')
2607
+ t.sub!(/[&*]$/, '')
2608
+ if isEnum(t)
2609
+ return 2 + const_point
2610
+ end
2611
+ end
2612
+ elsif argtype == 'B'
2613
+ if typename =~ /^(?:bool)[*&]?$/
2614
+ return 2 + const_point
2615
+ end
2616
+ elsif argtype == 's'
2617
+ if typename =~ /^(const )?((QChar)[*&]?)$/
2618
+ return 6 + const_point
2619
+ elsif typename =~ /^(?:(u(nsigned )?)?char\*)$/
2620
+ return 4 + const_point
2621
+ elsif typename =~ /^(?:const (u(nsigned )?)?char\*)$/
2622
+ return 2 + const_point
2623
+ elsif typename =~ /^(?:(?:const )?(QString)[*&]?)$/
2624
+ return 8 + const_point
2625
+ end
2626
+ elsif argtype == 'a'
2627
+ # FIXME: shouldn't be hardcoded. Installed handlers should tell what ruby type they expect.
2628
+ if typename =~ /^(?:
2629
+ const\ QCOORD\*|
2630
+ (?:const\ )?
2631
+ (?:
2632
+ QStringList[\*&]?|
2633
+ QValueList<int>[\*&]?|
2634
+ QRgb\*|
2635
+ char\*\*
2636
+ )
2637
+ )$/x
2638
+ return 2 + const_point
2639
+ end
2640
+ elsif argtype == 'u'
2641
+ # Give nil matched against string types a higher score than anything else
2642
+ if typename =~ /^(?:u?char\*|const u?char\*|(?:const )?((Q(C?)String))[*&]?)$/
2643
+ return 4 + const_point
2644
+ # Numerics will give a runtime conversion error, so they fail the match
2645
+ elsif typename =~ /^(?:short|ushort|uint|long|ulong|signed|unsigned|int)$/
2646
+ return -99
2647
+ else
2648
+ return 2 + const_point
2649
+ end
2650
+ elsif argtype == 'U'
2651
+ if typename =~ /QStringList/
2652
+ return 4 + const_point
2653
+ else
2654
+ return 2 + const_point
2655
+ end
2656
+ else
2657
+ t = typename.sub(/^const\s+/, '')
2658
+ t.sub!(/(::)?Ptr$/, '')
2659
+ t.sub!(/[&*]$/, '')
2660
+ if argtype == t
2661
+ return 4 + const_point
2662
+ elsif classIsa(argtype, t)
2663
+ return 2 + const_point
2664
+ elsif isEnum(argtype) and
2665
+ (t =~ /int|qint32|uint|quint32|long|ulong/ or isEnum(t))
2666
+ return 2 + const_point
2667
+ end
2668
+ end
2669
+ return -99
2670
+ end
2671
+
2672
+ def Internal.find_class(classname)
2673
+ @@classes[classname]
2674
+ end
2675
+
2676
+ # Runs the initializer as far as allocating the Qt C++ instance.
2677
+ # Then use a throw to jump back to here with the C++ instance
2678
+ # wrapped in a new ruby variable of type T_DATA
2679
+ def Internal.try_initialize(instance, *args)
2680
+ initializer = instance.method(:initialize)
2681
+ catch :newqt do
2682
+ initializer.call(*args)
2683
+ end
2684
+ end
2685
+
2686
+ # If a block was passed to the constructor, then
2687
+ # run that now. Either run the context of the new instance
2688
+ # if no args were passed to the block. Or otherwise,
2689
+ # run the block in the context of the arg.
2690
+ def Internal.run_initializer_block(instance, block)
2691
+ if block.arity == -1 || block.arity == 0
2692
+ instance.instance_eval(&block)
2693
+ elsif block.arity == 1
2694
+ block.call(instance)
2695
+ else
2696
+ raise ArgumentError, "Wrong number of arguments to block(#{block.arity} for 1)"
2697
+ end
2698
+ end
2699
+
2700
+ # Looks up and executes a Qt method
2701
+ #
2702
+ # package - Always the string 'Qt'
2703
+ # method - Methodname as a string
2704
+ # klass - Ruby class object
2705
+ # this - instance of class
2706
+ # args - arguments to method call
2707
+ #
2708
+ def Internal.do_method_missing(package, method, klass, this, *args)
2709
+ # Determine class name
2710
+ if klass.class == Module
2711
+ # If a module use the module's name - typically Qt
2712
+ classname = klass.name
2713
+ else
2714
+ # Lookup Qt class name from Ruby class name
2715
+ classname = @@cpp_names[klass.name]
2716
+ if classname.nil?
2717
+ # Make sure we haven't backed all the way up to Object
2718
+ if klass != Object and klass != Qt
2719
+ # Don't recognize this class so try the superclass
2720
+ return do_method_missing(package, method, klass.superclass, this, *args)
2721
+ else
2722
+ # Give up if we back all the way up to Object
2723
+ return nil
2724
+ end
2725
+ end
2726
+ end
2727
+
2728
+ # Modify constructor method name from new to the name of the Qt class
2729
+ # and remove any namespacing
2730
+ if method == "new"
2731
+ method = classname.dup
2732
+ method.gsub!(/^.*::/,"")
2733
+ end
2734
+
2735
+ # If the method contains no letters it must be an operator, append "operator" to the
2736
+ # method name
2737
+ method = "operator" + method.sub("@","") if method !~ /[a-zA-Z]+/
2738
+
2739
+ # Change foobar= to setFoobar()
2740
+ method = 'set' + method[0,1].upcase + method[1,method.length].sub("=", "") if method =~ /.*[^-+%\/|=]=$/ && method != 'operator='
2741
+
2742
+ # Build list of munged method names which is the methodname followed
2743
+ # by symbols that indicate the basic type of the method's arguments
2744
+ #
2745
+ # Plain scalar = $
2746
+ # Object = #
2747
+ # Non-scalar (reference to array or hash, undef) = ?
2748
+ #
2749
+ methods = []
2750
+ methods << method.dup
2751
+ args.each do |arg|
2752
+ if arg.nil?
2753
+ # For each nil arg encountered, triple the number of munged method
2754
+ # templates, in order to cover all possible types that can match nil
2755
+ temp = []
2756
+ methods.collect! do |meth|
2757
+ temp << meth + '?'
2758
+ temp << meth + '#'
2759
+ meth << '$'
2760
+ end
2761
+ methods.concat(temp)
2762
+ elsif isObject(arg)
2763
+ methods.collect! { |meth| meth << '#' }
2764
+ elsif arg.kind_of? Array or arg.kind_of? Hash
2765
+ methods.collect! { |meth| meth << '?' }
2766
+ else
2767
+ methods.collect! { |meth| meth << '$' }
2768
+ end
2769
+ end
2770
+
2771
+ # Create list of methodIds that match classname and munged method name
2772
+ methodIds = []
2773
+ methods.collect { |meth| methodIds.concat( findMethod(classname, meth) ) }
2774
+
2775
+ # If we didn't find any methods and the method name contains an underscore
2776
+ # then convert to camelcase and try again
2777
+ if method =~ /._./ && methodIds.length == 0
2778
+ # If the method name contains underscores, convert to camel case
2779
+ # form and try again
2780
+ method.gsub!(/(.)_(.)/) {$1 + $2.upcase}
2781
+ return do_method_missing(package, method, klass, this, *args)
2782
+ end
2783
+
2784
+ # Debugging output for method lookup
2785
+ if debug_level >= DebugLevel::High
2786
+ puts "Searching for #{classname}##{method}"
2787
+ puts "Munged method names:"
2788
+ methods.each {|meth| puts " #{meth}"}
2789
+ puts "candidate list:"
2790
+ prototypes = dumpCandidates(methodIds).split("\n")
2791
+ line_len = (prototypes.collect { |p| p.length }).max
2792
+ prototypes.zip(methodIds) {
2793
+ |prototype,id| puts "#{prototype.ljust line_len} (smoke: #{id.smoke} index: #{id.index})"
2794
+ }
2795
+ end
2796
+
2797
+ # Find the best match
2798
+ chosen = nil
2799
+ if methodIds.length > 0
2800
+ best_match = -1
2801
+ methodIds.each do
2802
+ |id|
2803
+ puts "matching => smoke: #{id.smoke} index: #{id.index}" if debug_level >= DebugLevel::High
2804
+ current_match = (isConstMethod(id) ? 1 : 0)
2805
+ (0...args.length).each do
2806
+ |i|
2807
+ typename = get_arg_type_name(id, i)
2808
+ argtype = get_value_type(args[i])
2809
+ score = checkarg(argtype, typename)
2810
+ current_match += score
2811
+ puts " #{typename} (#{argtype}) score: #{score}" if debug_level >= DebugLevel::High
2812
+ end
2813
+
2814
+ # Note that if current_match > best_match, then chosen must be nil
2815
+ if current_match > best_match
2816
+ best_match = current_match
2817
+ chosen = id
2818
+ # Ties are bad - but it is better to chose something than to fail
2819
+ elsif current_match == best_match && id.smoke == chosen.smoke
2820
+ puts " ****** warning: multiple methods with the same score of #{current_match}: #{chosen.index} and #{id.index}" if debug_level >= DebugLevel::Minimal
2821
+ chosen = id
2822
+ end
2823
+ puts " match => smoke: #{id.smoke} index: #{id.index} score: #{current_match} chosen: #{chosen ? chosen.index : nil}" if debug_level >= DebugLevel::High
2824
+ end
2825
+ end
2826
+
2827
+ # Additional debugging output
2828
+ if debug_level >= DebugLevel::Minimal && chosen.nil? && method !~ /^operator/
2829
+ id = find_pclassid(normalize_classname(klass.name))
2830
+ hash = findAllMethods(id)
2831
+ constructor_names = nil
2832
+ if method == classname
2833
+ puts "No matching constructor found, possibles:\n"
2834
+ constructor_names = hash.keys.grep(/^#{classname}/)
2835
+ else
2836
+ puts "Possible prototypes:"
2837
+ constructor_names = hash.keys
2838
+ end
2839
+ method_ids = hash.values_at(*constructor_names).flatten
2840
+ puts dumpCandidates(method_ids)
2841
+ else
2842
+ puts "setCurrentMethod(smokeList index: #{chosen.smoke}, meth index: #{chosen.index})" if debug_level >= DebugLevel::High && chosen
2843
+ end
2844
+
2845
+ # Select the chosen method
2846
+ setCurrentMethod(chosen) if chosen
2847
+ return nil
2848
+ end
2849
+
2850
+ def Internal.init_all_classes()
2851
+ Qt::Internal::getClassList().each do |c|
2852
+ if c == "Qt"
2853
+ # Don't change Qt to Qt::t, just leave as is
2854
+ @@cpp_names["Qt"] = c
2855
+ elsif c != "QInternal" && !c.empty?
2856
+ Qt::Internal::init_class(c)
2857
+ end
2858
+ end
2859
+
2860
+ @@classes['Qt::Integer'] = Qt::Integer
2861
+ @@classes['Qt::Boolean'] = Qt::Boolean
2862
+ @@classes['Qt::Enum'] = Qt::Enum
2863
+ end
2864
+
2865
+ def Internal.get_qinteger(num)
2866
+ return num.value
2867
+ end
2868
+
2869
+ def Internal.set_qinteger(num, val)
2870
+ return num.value = val
2871
+ end
2872
+
2873
+ def Internal.create_qenum(num, enum_type)
2874
+ return Qt::Enum.new(num, enum_type)
2875
+ end
2876
+
2877
+ def Internal.get_qenum_type(e)
2878
+ return e.type
2879
+ end
2880
+
2881
+ def Internal.get_qboolean(b)
2882
+ return b.value
2883
+ end
2884
+
2885
+ def Internal.set_qboolean(b, val)
2886
+ return b.value = val
2887
+ end
2888
+
2889
+ def Internal.getAllParents(class_id, res)
2890
+ getIsa(class_id).each do |s|
2891
+ c = findClass(s)
2892
+ res << c
2893
+ getAllParents(c, res)
2894
+ end
2895
+ end
2896
+
2897
+ # Keeps a hash of strings against their corresponding offsets
2898
+ # within the qt_meta_stringdata sequence of null terminated
2899
+ # strings. Returns a proc to get an offset given a string.
2900
+ # That proc also adds new strings to the 'data' array, and updates
2901
+ # the corresponding 'pack_str' Array#pack template.
2902
+ def Internal.string_table_handler(data, pack_str)
2903
+ hsh = {}
2904
+ offset = 0
2905
+ return lambda do |str|
2906
+ if !hsh.has_key? str
2907
+ hsh[str] = offset
2908
+ data << str
2909
+ pack_str << "a*x"
2910
+ offset += str.length + 1
2911
+ end
2912
+
2913
+ return hsh[str]
2914
+ end
2915
+ end
2916
+
2917
+ def Internal.makeMetaData(classname, classinfos, dbus, signals, slots)
2918
+ # Each entry in 'stringdata' corresponds to a string in the
2919
+ # qt_meta_stringdata_<classname> structure.
2920
+ # 'pack_string' is used to convert 'stringdata' into the
2921
+ # binary sequence of null terminated strings for the metaObject
2922
+ stringdata = []
2923
+ pack_string = ""
2924
+ string_table = string_table_handler(stringdata, pack_string)
2925
+
2926
+ # This is used to create the array of uints that make up the
2927
+ # qt_meta_data_<classname> structure in the metaObject
2928
+ data = [1, # revision
2929
+ string_table.call(classname), # classname
2930
+ classinfos.length, classinfos.length > 0 ? 10 : 0, # classinfo
2931
+ signals.length + slots.length,
2932
+ 10 + (2*classinfos.length), # methods
2933
+ 0, 0, # properties
2934
+ 0, 0] # enums/sets
2935
+
2936
+ classinfos.each do |entry|
2937
+ data.push string_table.call(entry[0]) # key
2938
+ data.push string_table.call(entry[1]) # value
2939
+ end
2940
+
2941
+ signals.each do |entry|
2942
+ data.push string_table.call(entry.full_name) # signature
2943
+ data.push string_table.call(entry.full_name.delete("^,")) # parameters
2944
+ data.push string_table.call(entry.reply_type) # type, "" means void
2945
+ data.push string_table.call("") # tag
2946
+ if dbus
2947
+ data.push MethodScriptable | MethodSignal | AccessPublic
2948
+ else
2949
+ data.push entry.access # flags, always protected for now
2950
+ end
2951
+ end
2952
+
2953
+ slots.each do |entry|
2954
+ data.push string_table.call(entry.full_name) # signature
2955
+ data.push string_table.call(entry.full_name.delete("^,")) # parameters
2956
+ data.push string_table.call(entry.reply_type) # type, "" means void
2957
+ data.push string_table.call("") # tag
2958
+ if dbus
2959
+ data.push MethodScriptable | MethodSlot | AccessPublic # flags, always public for now
2960
+ else
2961
+ data.push entry.access # flags, always public for now
2962
+ end
2963
+ end
2964
+
2965
+ data.push 0 # eod
2966
+
2967
+ return [stringdata.pack(pack_string), data]
2968
+ end
2969
+
2970
+ def Internal.getMetaObject(klass, qobject)
2971
+ if klass.nil?
2972
+ klass = qobject.class
2973
+ end
2974
+
2975
+ parentMeta = nil
2976
+ if @@cpp_names[klass.superclass.name].nil?
2977
+ parentMeta = getMetaObject(klass.superclass, qobject)
2978
+ end
2979
+
2980
+ meta = Meta[klass.name]
2981
+ if meta.nil?
2982
+ meta = Qt::MetaInfo.new(klass)
2983
+ end
2984
+
2985
+ if meta.metaobject.nil? or meta.changed
2986
+ stringdata, data = makeMetaData( qobject.class.name,
2987
+ meta.classinfos,
2988
+ meta.dbus,
2989
+ meta.signals,
2990
+ meta.slots )
2991
+ meta.metaobject = make_metaObject(qobject, parentMeta, stringdata, data)
2992
+ meta.changed = false
2993
+ end
2994
+
2995
+ meta.metaobject
2996
+ end
2997
+
2998
+ # Handles calls of the form:
2999
+ # connect(myobj, SIGNAL('mysig(int)'), mytarget) {|arg(s)| ...}
3000
+ # connect(myobj, SIGNAL('mysig(int)')) {|arg(s)| ...}
3001
+ # connect(myobj, SIGNAL(:mysig), mytarget) { ...}
3002
+ # connect(myobj, SIGNAL(:mysig)) { ...}
3003
+ def Internal.connect(src, signal, target, block)
3004
+ args = (signal =~ /\((.*)\)/) ? $1 : ""
3005
+ signature = Qt::MetaObject.normalizedSignature("invoke(%s)" % args).to_s
3006
+ return Qt::Object.connect( src,
3007
+ signal,
3008
+ Qt::BlockInvocation.new(target, block.to_proc, signature),
3009
+ SLOT(signature) )
3010
+ end
3011
+
3012
+ # Handles calls of the form:
3013
+ # connect(SIGNAL(:mysig)) { ...}
3014
+ # connect(SIGNAL('mysig(int)')) {|arg(s)| ...}
3015
+ def Internal.signal_connect(src, signal, block)
3016
+ args = (signal =~ /\((.*)\)/) ? $1 : ""
3017
+ signature = Qt::MetaObject.normalizedSignature("invoke(%s)" % args).to_s
3018
+ return Qt::Object.connect( src,
3019
+ signal,
3020
+ Qt::SignalBlockInvocation.new(src, block.to_proc, signature),
3021
+ SLOT(signature) )
3022
+ end
3023
+
3024
+ # Handles calls of the form:
3025
+ # connect(:mysig, mytarget, :mymethod))
3026
+ # connect(SIGNAL('mysignal(int)'), mytarget, :mymethod))
3027
+ def Internal.method_connect(src, signal, target, method)
3028
+ signal = SIGNAL(signal) if signal.is_a?Symbol
3029
+ args = (signal =~ /\((.*)\)/) ? $1 : ""
3030
+ signature = Qt::MetaObject.normalizedSignature("invoke(%s)" % args).to_s
3031
+ return Qt::Object.connect( src,
3032
+ signal,
3033
+ Qt::MethodInvocation.new(target, method, signature),
3034
+ SLOT(signature) )
3035
+ end
3036
+
3037
+ # Handles calls of the form:
3038
+ # Qt::Timer.singleShot(500, myobj) { ...}
3039
+ def Internal.single_shot_timer_connect(interval, target, block)
3040
+ return Qt::Timer.singleShot( interval,
3041
+ Qt::BlockInvocation.new(target, block, "invoke()"),
3042
+ SLOT("invoke()") )
3043
+ end
3044
+ end # Qt::Internal
3045
+
3046
+ Meta = {}
3047
+
3048
+ # An entry for each signal or slot
3049
+ # Example
3050
+ # int foobar(QString,bool)
3051
+ # :name is 'foobar'
3052
+ # :full_name is 'foobar(QString,bool)'
3053
+ # :arg_types is 'QString,bool'
3054
+ # :reply_type is 'int'
3055
+ QObjectMember = Struct.new :name, :full_name, :arg_types, :reply_type, :access
3056
+
3057
+ class MetaInfo
3058
+ attr_accessor :classinfos, :dbus, :signals, :slots, :metaobject, :mocargs, :changed
3059
+
3060
+ def initialize(klass)
3061
+ Meta[klass.name] = self
3062
+ @klass = klass
3063
+ @metaobject = nil
3064
+ @signals = []
3065
+ @slots = []
3066
+ @classinfos = []
3067
+ @dbus = false
3068
+ @changed = false
3069
+ Internal.addMetaObjectMethods(klass)
3070
+ end
3071
+
3072
+ def add_signals(signal_list, access)
3073
+ signal_names = []
3074
+ signal_list.each do |signal|
3075
+ if signal.kind_of? Symbol
3076
+ signal = signal.to_s + "()"
3077
+ end
3078
+ signal = Qt::MetaObject.normalizedSignature(signal).to_s
3079
+ if signal =~ /^(([\w,<>:]*)\s+)?([^\s]*)\((.*)\)/
3080
+ @signals.push QObjectMember.new( $3,
3081
+ $3 + "(" + $4 + ")",
3082
+ $4,
3083
+ ($2 == 'void' || $2.nil?) ? "" : $2,
3084
+ access )
3085
+ signal_names << $3
3086
+ else
3087
+ qWarning( "#{@klass.name}: Invalid signal format: '#{signal}'" )
3088
+ end
3089
+ end
3090
+ Internal.addSignalMethods(@klass, signal_names)
3091
+ end
3092
+
3093
+ # Return a list of signals, including inherited ones
3094
+ def get_signals
3095
+ all_signals = []
3096
+ current = @klass
3097
+ while current != Qt::Base
3098
+ meta = Meta[current.name]
3099
+ if !meta.nil?
3100
+ all_signals.concat meta.signals
3101
+ end
3102
+ current = current.superclass
3103
+ end
3104
+ return all_signals
3105
+ end
3106
+
3107
+ def add_slots(slot_list, access)
3108
+ slot_list.each do |slot|
3109
+ if slot.kind_of? Symbol
3110
+ slot = slot.to_s + "()"
3111
+ end
3112
+ slot = Qt::MetaObject.normalizedSignature(slot).to_s
3113
+ if slot =~ /^(([\w,<>:]*)\s+)?([^\s]*)\((.*)\)/
3114
+ @slots.push QObjectMember.new( $3,
3115
+ $3 + "(" + $4 + ")",
3116
+ $4,
3117
+ ($2 == 'void' || $2.nil?) ? "" : $2,
3118
+ access )
3119
+ else
3120
+ qWarning( "#{@klass.name}: Invalid slot format: '#{slot}'" )
3121
+ end
3122
+ end
3123
+ end
3124
+
3125
+ def add_classinfo(key, value)
3126
+ @classinfos.push [key, value]
3127
+ if key == 'D-Bus Interface'
3128
+ @dbus = true
3129
+ end
3130
+ end
3131
+ end # Qt::MetaInfo
3132
+
3133
+ # These values are from the enum WindowType in qnamespace.h.
3134
+ # Some of the names such as 'Qt::Dialog', clash with QtRuby
3135
+ # class names. So add some constants here to use instead,
3136
+ # renamed with an ending of 'Type'.
3137
+ WidgetType = 0x00000000
3138
+ WindowType = 0x00000001
3139
+ DialogType = 0x00000002 | WindowType
3140
+ SheetType = 0x00000004 | WindowType
3141
+ DrawerType = 0x00000006 | WindowType
3142
+ PopupType = 0x00000008 | WindowType
3143
+ ToolType = 0x0000000a | WindowType
3144
+ ToolTipType = 0x0000000c | WindowType
3145
+ SplashScreenType = 0x0000000e | WindowType
3146
+ DesktopType = 0x00000010 | WindowType
3147
+ SubWindowType = 0x00000012
3148
+
3149
+ end # Qt
3150
+
3151
+ class Object
3152
+ def SIGNAL(signal)
3153
+ if signal.kind_of? Symbol
3154
+ return "2" + signal.to_s + "()"
3155
+ else
3156
+ return "2" + signal
3157
+ end
3158
+ end
3159
+
3160
+ def SLOT(slot)
3161
+ if slot.kind_of? Symbol
3162
+ return "1" + slot.to_s + "()"
3163
+ else
3164
+ return "1" + slot
3165
+ end
3166
+ end
3167
+
3168
+ def emit(signal)
3169
+ return signal
3170
+ end
3171
+
3172
+ def QT_TR_NOOP(x) x end
3173
+ def QT_TRANSLATE_NOOP(scope, x) x end
3174
+
3175
+ # See the discussion here: http://eigenclass.org/hiki.rb?instance_exec
3176
+ # about implementations of the ruby 1.9 method instance_exec(). This
3177
+ # version is the one from Rails. It isn't thread safe, but that doesn't
3178
+ # matter for the intended use in invoking blocks as Qt slots.
3179
+ def instance_exec(*arguments, &block)
3180
+ block.bind(self)[*arguments]
3181
+ end unless defined? instance_exec
3182
+ end
3183
+
3184
+ class Proc
3185
+ # Part of the Rails Object#instance_exec implementation
3186
+ def bind(object)
3187
+ block, time = self, Time.now
3188
+ (class << object; self end).class_eval do
3189
+ method_name = "__bind_#{time.to_i}_#{time.usec}"
3190
+ define_method(method_name, &block)
3191
+ method = instance_method(method_name)
3192
+ remove_method(method_name)
3193
+ method
3194
+ end.bind(object)
3195
+ end
3196
+ end
3197
+
3198
+ class Module
3199
+ alias_method :_constants, :constants
3200
+ alias_method :_instance_methods, :instance_methods
3201
+ alias_method :_protected_instance_methods, :protected_instance_methods
3202
+ alias_method :_public_instance_methods, :public_instance_methods
3203
+
3204
+ private :_constants, :_instance_methods
3205
+ private :_protected_instance_methods, :_public_instance_methods
3206
+
3207
+ if RUBY_VERSION < '1.9'
3208
+ def constants
3209
+ qt_methods(_constants, 0x10, true)
3210
+ end
3211
+ else
3212
+ def constants(_arg = true)
3213
+ qt_methods(_constants, 0x10, true)
3214
+ end
3215
+ end
3216
+
3217
+ def instance_methods(inc_super=true)
3218
+ qt_methods(_instance_methods(inc_super), 0x0, inc_super)
3219
+ end
3220
+
3221
+ def protected_instance_methods(inc_super=true)
3222
+ qt_methods(_protected_instance_methods(inc_super), 0x80, inc_super)
3223
+ end
3224
+
3225
+ def public_instance_methods(inc_super=true)
3226
+ qt_methods(_public_instance_methods(inc_super), 0x0, inc_super)
3227
+ end
3228
+
3229
+ private
3230
+ def qt_methods(meths, flags, inc_super=true)
3231
+ if !self.kind_of? Class
3232
+ return meths
3233
+ end
3234
+
3235
+ klass = self
3236
+ classid = Qt::Internal::ModuleIndex.new(0, 0)
3237
+ loop do
3238
+ classid = Qt::Internal::find_pclassid(klass.name)
3239
+ break if classid.index
3240
+
3241
+ klass = klass.superclass
3242
+ if klass.nil?
3243
+ return meths
3244
+ end
3245
+ end
3246
+
3247
+ # These methods are all defined in Qt::Base, even if they aren't supported by a particular
3248
+ # subclass, so remove them to avoid confusion
3249
+ meths -= ["%", "&", "*", "**", "+", "-", "-@", "/", "<", "<<", "<=", ">", ">=", ">>", "|", "~", "^"]
3250
+ ids = []
3251
+ if inc_super
3252
+ Qt::Internal::getAllParents(classid, ids)
3253
+ end
3254
+ ids << classid
3255
+ ids.each { |c| Qt::Internal::findAllMethodNames(meths, c, flags) }
3256
+ return meths.uniq
3257
+ end
3258
+ end