qml 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +46 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +15 -0
  5. data/.yardopts +4 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +351 -0
  9. data/Rakefile +6 -0
  10. data/examples/assets/fonts/fontawesome-webfont.ttf +0 -0
  11. data/examples/fizzbuzz/fizzbuzz.rb +43 -0
  12. data/examples/fizzbuzz/main.qml +38 -0
  13. data/examples/imageprovider/imageprovider.rb +57 -0
  14. data/examples/imageprovider/main.qml +51 -0
  15. data/examples/todo/main.qml +70 -0
  16. data/examples/todo/todo.rb +36 -0
  17. data/examples/twitter/main.qml +36 -0
  18. data/examples/twitter/twitter.rb +55 -0
  19. data/ext/qml/accessclass.cpp +71 -0
  20. data/ext/qml/accessclass.h +19 -0
  21. data/ext/qml/accessobject.cpp +30 -0
  22. data/ext/qml/accessobject.h +22 -0
  23. data/ext/qml/application.cpp +54 -0
  24. data/ext/qml/application.h +17 -0
  25. data/ext/qml/common.h +18 -0
  26. data/ext/qml/ext_accesssupport.cpp +77 -0
  27. data/ext/qml/ext_accesssupport.h +42 -0
  28. data/ext/qml/ext_gcmarker.cpp +39 -0
  29. data/ext/qml/ext_gcmarker.h +27 -0
  30. data/ext/qml/ext_kernel.cpp +62 -0
  31. data/ext/qml/ext_kernel.h +11 -0
  32. data/ext/qml/ext_metaobject.cpp +410 -0
  33. data/ext/qml/ext_metaobject.h +62 -0
  34. data/ext/qml/ext_pluginloader.cpp +55 -0
  35. data/ext/qml/ext_pluginloader.h +32 -0
  36. data/ext/qml/ext_pointer.cpp +134 -0
  37. data/ext/qml/ext_pointer.h +43 -0
  38. data/ext/qml/ext_testutil.cpp +42 -0
  39. data/ext/qml/ext_testutil.h +11 -0
  40. data/ext/qml/extconf.rb +84 -0
  41. data/ext/qml/foreignclass.cpp +72 -0
  42. data/ext/qml/foreignclass.h +88 -0
  43. data/ext/qml/foreignmetaobject.cpp +345 -0
  44. data/ext/qml/foreignmetaobject.h +46 -0
  45. data/ext/qml/foreignobject.cpp +22 -0
  46. data/ext/qml/foreignobject.h +21 -0
  47. data/ext/qml/functioninfo.h +16 -0
  48. data/ext/qml/init.cpp +69 -0
  49. data/ext/qml/listmodel.cpp +112 -0
  50. data/ext/qml/listmodel.h +43 -0
  51. data/ext/qml/markable.h +12 -0
  52. data/ext/qml/objectdata.cpp +26 -0
  53. data/ext/qml/objectdata.h +20 -0
  54. data/ext/qml/objectgc.cpp +69 -0
  55. data/ext/qml/objectgc.h +28 -0
  56. data/ext/qml/plugins/core/applicationextension.cpp +34 -0
  57. data/ext/qml/plugins/core/applicationextension.h +28 -0
  58. data/ext/qml/plugins/core/componentextension.cpp +41 -0
  59. data/ext/qml/plugins/core/componentextension.h +28 -0
  60. data/ext/qml/plugins/core/contextextension.cpp +39 -0
  61. data/ext/qml/plugins/core/contextextension.h +29 -0
  62. data/ext/qml/plugins/core/core.pro +29 -0
  63. data/ext/qml/plugins/core/coreplugin.cpp +87 -0
  64. data/ext/qml/plugins/core/coreplugin.h +49 -0
  65. data/ext/qml/plugins/core/engineextension.cpp +27 -0
  66. data/ext/qml/plugins/core/engineextension.h +28 -0
  67. data/ext/qml/plugins/core/imageprovider.cpp +38 -0
  68. data/ext/qml/plugins/core/imageprovider.h +18 -0
  69. data/ext/qml/plugins/core/imagerequestpromise.cpp +19 -0
  70. data/ext/qml/plugins/core/imagerequestpromise.h +21 -0
  71. data/ext/qml/plugins/core/qmlexception.cpp +11 -0
  72. data/ext/qml/plugins/core/qmlexception.h +17 -0
  73. data/ext/qml/plugins/testutil/objectlifechecker.cpp +17 -0
  74. data/ext/qml/plugins/testutil/objectlifechecker.h +24 -0
  75. data/ext/qml/plugins/testutil/ownershiptest.cpp +26 -0
  76. data/ext/qml/plugins/testutil/ownershiptest.h +30 -0
  77. data/ext/qml/plugins/testutil/testobject.cpp +6 -0
  78. data/ext/qml/plugins/testutil/testobject.h +108 -0
  79. data/ext/qml/plugins/testutil/testobjectsubclass.cpp +10 -0
  80. data/ext/qml/plugins/testutil/testobjectsubclass.h +19 -0
  81. data/ext/qml/plugins/testutil/testutil.pro +20 -0
  82. data/ext/qml/plugins/testutil/testutilplugin.cpp +47 -0
  83. data/ext/qml/plugins/testutil/testutilplugin.h +32 -0
  84. data/ext/qml/qmltyperegisterer.cpp +74 -0
  85. data/ext/qml/qmltyperegisterer.h +30 -0
  86. data/ext/qml/rubyclass.cpp +94 -0
  87. data/ext/qml/rubyclass.h +234 -0
  88. data/ext/qml/rubyvalue.cpp +690 -0
  89. data/ext/qml/rubyvalue.h +256 -0
  90. data/ext/qml/signalforwarder.cpp +66 -0
  91. data/ext/qml/signalforwarder.h +29 -0
  92. data/ext/qml/util.cpp +120 -0
  93. data/ext/qml/util.h +101 -0
  94. data/ext/qml/valuereference.cpp +50 -0
  95. data/ext/qml/valuereference.h +22 -0
  96. data/ext/qml/weakvaluereference.cpp +27 -0
  97. data/ext/qml/weakvaluereference.h +19 -0
  98. data/lib/qml.rb +41 -0
  99. data/lib/qml/access.rb +137 -0
  100. data/lib/qml/application.rb +139 -0
  101. data/lib/qml/class_builder.rb +126 -0
  102. data/lib/qml/component.rb +53 -0
  103. data/lib/qml/context.rb +71 -0
  104. data/lib/qml/data.rb +2 -0
  105. data/lib/qml/data/array_model.rb +103 -0
  106. data/lib/qml/data/error.rb +5 -0
  107. data/lib/qml/data/list_model.rb +146 -0
  108. data/lib/qml/dispatchable.rb +34 -0
  109. data/lib/qml/dispatcher.rb +61 -0
  110. data/lib/qml/engine.rb +54 -0
  111. data/lib/qml/error_converter.rb +15 -0
  112. data/lib/qml/errors.rb +26 -0
  113. data/lib/qml/geometry.rb +3 -0
  114. data/lib/qml/geometry/point.rb +5 -0
  115. data/lib/qml/geometry/rectangle.rb +5 -0
  116. data/lib/qml/geometry/size.rb +5 -0
  117. data/lib/qml/image_provider.rb +87 -0
  118. data/lib/qml/meta_object.rb +20 -0
  119. data/lib/qml/models.rb +1 -0
  120. data/lib/qml/name_helper.rb +12 -0
  121. data/lib/qml/platform.rb +15 -0
  122. data/lib/qml/plugin_loader.rb +46 -0
  123. data/lib/qml/plugins.rb +26 -0
  124. data/lib/qml/qml.rb +1 -0
  125. data/lib/qml/qt.rb +6 -0
  126. data/lib/qml/qt_classes.rb +9 -0
  127. data/lib/qml/qt_object_base.rb +108 -0
  128. data/lib/qml/reactive.rb +8 -0
  129. data/lib/qml/reactive/bindable.rb +79 -0
  130. data/lib/qml/reactive/chained_signal.rb +25 -0
  131. data/lib/qml/reactive/error.rb +5 -0
  132. data/lib/qml/reactive/object.rb +278 -0
  133. data/lib/qml/reactive/property.rb +19 -0
  134. data/lib/qml/reactive/signal.rb +116 -0
  135. data/lib/qml/reactive/signal_spy.rb +27 -0
  136. data/lib/qml/reactive/signals/map_signal.rb +21 -0
  137. data/lib/qml/reactive/signals/merge_signal.rb +21 -0
  138. data/lib/qml/reactive/signals/select_signal.rb +21 -0
  139. data/lib/qml/reactive/simple_property.rb +17 -0
  140. data/lib/qml/reactive/unbound_property.rb +42 -0
  141. data/lib/qml/reactive/unbound_signal.rb +51 -0
  142. data/lib/qml/root_path.rb +3 -0
  143. data/lib/qml/test_util.rb +1 -0
  144. data/lib/qml/test_util/object_life_checker.rb +17 -0
  145. data/lib/qml/version.rb +3 -0
  146. data/lib/qml/wrappable.rb +9 -0
  147. data/qml.gemspec +28 -0
  148. data/spec/assets/testobj.qml +5 -0
  149. data/spec/qml/.access_spec.rb.swp +0 -0
  150. data/spec/qml/access_spec.rb +162 -0
  151. data/spec/qml/application_spec.rb +43 -0
  152. data/spec/qml/component_spec.rb +44 -0
  153. data/spec/qml/context_spec.rb +43 -0
  154. data/spec/qml/conversion_spec.rb +59 -0
  155. data/spec/qml/data/array_model_spec.rb +215 -0
  156. data/spec/qml/dispatchable_spec.rb +26 -0
  157. data/spec/qml/dispatcher_spec.rb +48 -0
  158. data/spec/qml/geometry/point_spec.rb +4 -0
  159. data/spec/qml/geometry/rectangle_spec.rb +4 -0
  160. data/spec/qml/geometry/size_spec.rb +4 -0
  161. data/spec/qml/plugin_loader_spec.rb +33 -0
  162. data/spec/qml/qt_object_base_spec.rb +119 -0
  163. data/spec/qml/reactive/object_spec.rb +273 -0
  164. data/spec/qml/reactive/property_spec.rb +70 -0
  165. data/spec/qml/reactive/signal_spec.rb +191 -0
  166. data/spec/qml/reactive/signal_spy_spec.rb +26 -0
  167. data/spec/qml/test_object_spec.rb +186 -0
  168. data/spec/qml_spec.rb +7 -0
  169. data/spec/spec_helper.rb +5 -0
  170. metadata +321 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0dd71ef4746849334db1b91614801963b036e5f9
4
+ data.tar.gz: 364c1f9e5d2fd15f937dd5ab009982160fdcd121
5
+ SHA512:
6
+ metadata.gz: 6843d7ff307be7803b1748943a7cd83ee0a84e29016e9714fbb4545ed4759e94b664c27ac9956deff501823ac9c1f24af768c977833ee91dd8d89b2ec419e58b
7
+ data.tar.gz: 6eca2b5f9227c63241d1066053d922a9b5309b530476eeb780caa7a2e37be609a004fcb374ddbce3238846d4d03115f405cd1b9574487ea3803cc9e791b78979
@@ -0,0 +1,46 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.log
19
+ .ruby-version
20
+
21
+ # C++ objects and libs
22
+
23
+ *.slo
24
+ *.lo
25
+ *.o
26
+ *.a
27
+ *.la
28
+ *.lai
29
+ *.so
30
+ *.dll
31
+ *.dylib
32
+ *.bundle
33
+
34
+ # Qt-es
35
+
36
+ *.pro.user
37
+ *.pro.user.*
38
+ *.moc
39
+ moc_*.cpp
40
+ qrc_*.cpp
41
+ Makefile
42
+ *-build-*
43
+ .qmake.stash
44
+ *.autosave
45
+
46
+ examples/twitter/config.yml
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+ - 2.0.0
5
+ before_install:
6
+ - sudo apt-add-repository -y ppa:beineri/opt-qt521
7
+ - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
8
+ - sudo apt-get update
9
+ - sudo apt-get install -y g++-4.8 libffi-dev qt52base qt52declarative qt52declarative
10
+ - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
11
+ before_script:
12
+ - source /opt/qt52/bin/qt52-env.sh
13
+ - cd ext/qml
14
+ - bundle exec ruby extconf.rb
15
+ - make
@@ -0,0 +1,4 @@
1
+ --exclude lib/qml/qt_classes.rb
2
+ --protected
3
+ --no-private
4
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in qml.gemspec
4
+ gemspec name: "qml"
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ryohei Ikegami
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,351 @@
1
+ # ruby-qml
2
+
3
+ [![Build Status](https://travis-ci.org/seanchas116/ruby-qml.svg?branch=master)](https://travis-ci.org/seanchas116/ruby-qml)
4
+
5
+ **NOTE: ruby-qml is not yet released as a gem.**
6
+
7
+ ruby-qml is a QML / Qt Quick wrapper for Ruby.
8
+ It provides bindings between QML and Ruby and enables you to use Qt Quick-based GUI from Ruby.
9
+
10
+ ## Installation
11
+
12
+ ### OS X with Homebrew
13
+
14
+ Run the following commands to install ruby-qml on OS X with Homebrew:
15
+
16
+ $ brew install pkg-config
17
+ $ brew install libffi
18
+ $ brew install qt5
19
+ $ gem install qml -- --with-libffi-dir=$(brew --prefix libffi) --with-qt-dir=$(brew --prefix qt5)
20
+
21
+ ### General
22
+
23
+ #### Requirements
24
+
25
+ * pkg-config
26
+ * libffi
27
+ * Qt 5.2 or later
28
+
29
+ To install, use this command after installing requirements:
30
+
31
+ $ gem install qml
32
+
33
+ ### Use Gemfile
34
+
35
+ Add this line to your Gemfile:
36
+
37
+ gem 'qml'
38
+
39
+ And then execute:
40
+
41
+ $ bundle install
42
+
43
+ To pass build options, use `bundle config`.
44
+ For example:
45
+
46
+ $ bundle config build.qml --with-libffi-dir=$(brew --prefix libffi) --with-qt-dir=$(brew --prefix qt5)
47
+
48
+ The configuration will be saved in `~/.bundle/config`
49
+
50
+ ## Usage
51
+
52
+ ### Load QML file
53
+
54
+ The following code loads a QML file and shows an application window titled "Hello, world!".
55
+
56
+ ```ruby
57
+ QML.application do |app|
58
+ app.load_path Pathname(__FILE__) + '../main.qml'
59
+ end
60
+ ```
61
+
62
+ #### main.qml
63
+
64
+ ```qml
65
+ import QtQuick 2.2
66
+ import QtQuick.Controls 1.1
67
+
68
+ ApplicationWindow {
69
+ visible: true
70
+ width: 200
71
+ height: 100
72
+ title: "Hello, world!"
73
+ }
74
+ ```
75
+
76
+ ### Use Ruby class in QML
77
+
78
+ To make your class available to QML, include `QML::Access` and call `register_to_qml`.
79
+
80
+ By including `QML::Access`, you can also define **properties and signals** in Ruby classes like in QML.
81
+
82
+ Properties are used to bind data between QML and Ruby.
83
+ Signals are used to provide the observer pattern-like notification from Ruby to QML.
84
+
85
+ ```ruby
86
+ class FizzBuzz
87
+ include QML::Access
88
+ register_to_qml under: "Example", version: "1.0"
89
+
90
+ property :input, '0'
91
+ property :result , ''
92
+ signal :inputWasFizzBuzz, []
93
+
94
+ on_changed :input do
95
+ i = input.to_i
96
+ self.result = case
97
+ when i % 15 == 0
98
+ inputWasFizzBuzz.emit
99
+ "FizzBuzz"
100
+ when i % 3 == 0
101
+ "Fizz"
102
+ when i % 5 == 0
103
+ "Buzz"
104
+ else
105
+ i.to_s
106
+ end
107
+ end
108
+
109
+ def quit
110
+ puts "quitting..."
111
+ QML.application.quit
112
+ end
113
+ end
114
+ ```
115
+
116
+ ```qml
117
+ // main.qml
118
+
119
+ import QtQuick 2.2
120
+ import QtQuick.Controls 1.1
121
+ import QtQuick.Layouts 1.1
122
+ import Example 1.0
123
+
124
+ ApplicationWindow {
125
+ visible: true
126
+ width: 200
127
+ height: 200
128
+ title: "FizzBuzz"
129
+
130
+ ColumnLayout {
131
+ anchors.fill: parent
132
+ anchors.margins: 10
133
+ TextField {
134
+ placeholderText: "Input"
135
+ text: "0"
136
+ id: textField
137
+ }
138
+ Text {
139
+ y: 100
140
+ id: text
141
+ text: fizzBuzz.result
142
+ }
143
+ Button {
144
+ text: 'Quit'
145
+ onClicked: fizzBuzz.quit()
146
+ }
147
+ Text {
148
+ id: lastFizzBuzz
149
+ }
150
+ }
151
+ FizzBuzz {
152
+ id: fizzBuzz
153
+ input: textField.text
154
+ onInputWasFizzBuzz: lastFizzBuzz.text = "Last FizzBuzz: " + textField.text
155
+ }
156
+ }
157
+ ```
158
+
159
+ You can omit arguments of `register_to_qml` if they are obvious:
160
+
161
+ ```ruby
162
+ module Example
163
+ VERSION = '1.0.0'
164
+
165
+ class FizzBuzz
166
+ include QML::Access
167
+ register_to_qml
168
+
169
+ ...
170
+ end
171
+ end
172
+ ```
173
+
174
+ If the Ruby object is singleton, you can use the root context to make it available to QML.
175
+ In this case, you don't have to use `register_to_qml`.
176
+
177
+ ```ruby
178
+ class Foo
179
+ include QML::Access
180
+ def foo
181
+ puts "foo"
182
+ end
183
+ end
184
+
185
+ QML.application do |app|
186
+ app.context[:foo] = Foo.new
187
+ app.load_path Pathname(__FILE__) + '../main.qml'
188
+ end
189
+ ```
190
+
191
+ ### Pass data to QML ListModels
192
+
193
+ To bind list data between QML ListView and Ruby, you can use ListModels.
194
+
195
+ * `QML::Data::ListModel` - the base class for ruby-qml list models.
196
+
197
+ * `QML::Data::ArrayModel` - provides a simple list model implementation using Array.
198
+
199
+ This example uses `ArrayModel` to provide list data for a QML ListView.
200
+ When the content of the ArrayModel is changed, the list view is also automatically updated.
201
+
202
+ ```ruby
203
+ class TodoModel < QML::Data::ArrayModel
204
+ column :title, :description, :due_date
205
+ end
206
+
207
+ class TodoController
208
+ include QML::Access
209
+ register_to_qml under: "Example", version: "1.0"
210
+
211
+ property :model, TodoModel.new
212
+
213
+ def add(title, description, due_date)
214
+ item = OpenStruct.new(
215
+ title: title,
216
+ description: description,
217
+ due_date: due_date)
218
+ p item
219
+ model << item
220
+ end
221
+ end
222
+ ```
223
+
224
+ ```qml
225
+ ListView {
226
+ model: todo.model
227
+ delegate: Text {
228
+ text: "Title: " + title + ", Description: " + description + ", Due date: " + due_date
229
+ }
230
+ }
231
+ TodoController {
232
+ id: todo
233
+ }
234
+ ```
235
+
236
+ ### Use Qt objects in Ruby
237
+
238
+ In ruby-qml, Qt objects (QObject-derived C++ objects and QML objects) can be accessed from Ruby via the meta-object system of Qt.
239
+
240
+ You can access:
241
+
242
+ * Properties
243
+ * Signals
244
+ * Slots (as methods), Q_INVOKAVLE methods, QML methods
245
+
246
+ You cannot access:
247
+
248
+ * Normal C++ member functions
249
+
250
+ If their names are camelCase in Qt, ruby-qml aliases them as underscore_case.
251
+
252
+ ```ruby
253
+ # QML::Application is a wrapper for QApplication
254
+ app = QML.application
255
+
256
+ # set property
257
+ app.applicationName = "Test"
258
+ app.application_name = "Test" # aliased version
259
+
260
+ # connect to signal
261
+ app.aboutToQuit.connect do # "about_to_quit" is also OK
262
+ puts "quitting..."
263
+ end
264
+
265
+ # call method (slot)
266
+ app.quit
267
+ ```
268
+
269
+ ### Value conversions
270
+
271
+ The following types are automatically converted between Ruby and QML:
272
+
273
+ * Integer
274
+ * Double
275
+ * String
276
+ * Time
277
+ * Date
278
+ * DateTime
279
+ * Array
280
+ * Hash
281
+ * QML::Geometry::Point (QPoint, QPointF)
282
+ * QML::Geometry::Size (QSize, QSizeF)
283
+ * QML::Geometry::Rectangle (QRect, QRectF)
284
+ * QML::QtObjectBase (Qt objects)
285
+ * QML::Access
286
+ * QML::Data::ListModel
287
+
288
+ ### Load and use Qt C++ plugins
289
+
290
+ `PluginLoader` loads Qt C++ plugins.
291
+ It enables you to use your Qt C++ codes from Ruby easily.
292
+
293
+
294
+ ```c++
295
+ // plugin example
296
+ class MyPlugin : public QObject
297
+ {
298
+ Q_OBJECT
299
+ Q_PLUGIN_METADATA(IID "org.myplugin.MyPlugin")
300
+ public slots:
301
+ void foo() {
302
+ qDebug() << "foo";
303
+ }
304
+ };
305
+ ```
306
+
307
+ ```ruby
308
+ plugin = QML::PluginLoader.new(directory, "myplugin").instance
309
+ plugin.foo
310
+ ```
311
+
312
+ ### Garbage collection
313
+
314
+ To support garbage collection of Qt objects used in ruby-qml,
315
+ `#managed?` attribute of each Qt object wrappr determines its memory management status.
316
+
317
+ #### Managed objects
318
+
319
+ *Manged objects* are managed by Ruby and QML and garbage collected when no longer reachable.
320
+ All objects created inside QML and objects returned from C++ methods will be *managed* by default.
321
+
322
+ #### Unmanaged objects
323
+
324
+ *Unmanaged* objects are not managed and never garbage collected.
325
+ Objects that have parents and that obtained from properties of other Qt objects will be *unmanaged* by default.
326
+
327
+ #### Specify management status explicitly
328
+
329
+ The `#managed?` method returns whether the object is managed or not.
330
+ The `#prefer_managed` methods sets management status safely
331
+ (e.g., objects that are created by QML will remain managed and objects that have parents will remain unmanaged).
332
+
333
+ ```ruby
334
+ plugin = PluginLoader.new(path).instance
335
+ obj = plugin.create_object
336
+ obj.prefer_managed false
337
+ ```
338
+
339
+ ## Examples
340
+
341
+ See the `/example` directory.
342
+
343
+ ## Contributing
344
+
345
+ Contributions are welcome. When you are contributing to ruby-qml:
346
+
347
+ 1. Fork it ( http://github.com/seanchas116/ruby-qml/fork )
348
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
349
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
350
+ 4. Push to the branch (`git push origin my-new-feature`)
351
+ 5. Create new Pull Request