Module: QML
- Defined in:
- lib/qml/qt.rb,
lib/qml/access.rb,
lib/qml/engine.rb,
lib/qml/errors.rb,
lib/qml/signal.rb,
lib/qml/js_util.rb,
lib/qml/plugins.rb,
lib/qml/version.rb,
lib/qml/js_array.rb,
lib/qml/platform.rb,
lib/qml/reactive.rb,
lib/qml/component.rb,
lib/qml/interface.rb,
lib/qml/js_object.rb,
lib/qml/root_path.rb,
lib/qml/application.rb,
lib/qml/name_helper.rb,
lib/qml/proc_access.rb,
lib/qml/plugin_loader.rb,
lib/qml/data/list_model.rb,
lib/qml/data/array_model.rb,
lib/qml/data/query_model.rb,
lib/qml/data/list_model_access.rb,
ext/qml/qml.c,
ext/qml/engine.c,
ext/qml/exporter.c,
ext/qml/js_array.c,
ext/qml/js_object.c,
ext/qml/js_wrapper.c,
ext/qml/application.c,
ext/qml/js_function.c,
ext/qml/meta_object.c,
ext/qml/plugin_loader.c
Defined Under Namespace
Modules: Access, JSUtil, NameHelper, Platform, Plugins, Reactive Classes: AccessError, Application, ArrayModel, Component, Engine, Exporter, Interface, JSArray, JSFunction, JSObject, JSWrapper, ListModel, ListModelAccess, MetaObject, PluginError, PluginLoader, ProcAccess, QMLError, QueryModel, Signal
Constant Summary collapse
- VERSION =
'1.0.2'
- ROOT_PATH =
Pathname.new(__FILE__) + '../../..'
- INIT_BLOCKS =
[]
Class Method Summary collapse
-
.application ⇒ Application
Returns the instance of Application.
-
.engine ⇒ Engine
Returns the instance of Engine.
-
.init(args = []) ⇒ Object
Initializes ruby-qml.
- .init_impl(args) ⇒ Object private
- .initialized? ⇒ Boolean
- .next_tick(*args) ⇒ Object
- .on_init(&block) ⇒ Object
-
.qt ⇒ JSObject
QML Qt namespace object.
-
.run ⇒ Application
Creates an Application, yields it and then call Application#exec.
Class Method Details
.application ⇒ Application
Returns the instance of Application.
53 54 55 56 57 58 |
# File 'ext/qml/qml.c', line 53
static VALUE qml_application(VALUE module) {
if (NIL_P(rbqml_application)) {
rb_raise(rb_eRuntimeError, "QML not yet initialized");
}
return rbqml_application;
}
|
.engine ⇒ Engine
Returns the instance of Engine.
64 65 66 67 68 69 |
# File 'ext/qml/qml.c', line 64
static VALUE qml_engine(VALUE module) {
if (NIL_P(rbqml_engine)) {
rb_raise(rb_eRuntimeError, "QML not yet initialized");
}
return rbqml_engine;
}
|
.init(args = []) ⇒ Object
Initializes ruby-qml.
63 64 65 |
# File 'lib/qml/application.rb', line 63 def init(args = []) init_impl(args) end |
.init_impl(args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'ext/qml/qml.c', line 22
static VALUE qml_init(VALUE module, VALUE args) {
if (!NIL_P(rbqml_application)) {
rb_raise(rb_eRuntimeError, "QML already initialized");
}
rbqml_application = rb_funcall(rbqml_cApplication, rb_intern("new"), 1, args);
rbqml_engine = rb_funcall(rbqml_cEngine, rb_intern("new"), 0);
rb_gc_register_address(&rbqml_application);
rb_gc_register_address(&rbqml_engine);
VALUE blocks = rb_const_get(module, rb_intern("INIT_BLOCKS"));
for (int i = 0; i < RARRAY_LEN(blocks); ++i) {
rb_proc_call(RARRAY_AREF(blocks, i), rb_ary_new());
}
return module;
}
|
.initialized? ⇒ Boolean
41 42 43 44 45 46 47 |
# File 'ext/qml/qml.c', line 41
static VALUE qml_initialized_p(VALUE module) {
if (NIL_P(rbqml_application)) {
return Qfalse;
} else {
return Qtrue;
}
}
|
.next_tick(*args) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'ext/qml/qml.c', line 84
static VALUE qml_next_tick(int argc, VALUE *argv, VALUE module) {
VALUE block;
rb_scan_args(argc, argv, "&", &block);
rb_hash_aset(rbqml_referenced_objects, block, Qnil);
qmlbind_next_tick(nextTickCallback, (void *)block);
return block;
}
|
.on_init(&block) ⇒ Object
57 58 59 |
# File 'lib/qml/application.rb', line 57 def on_init(&block) INIT_BLOCKS << block end |
.qt ⇒ JSObject
Returns QML Qt namespace object.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/qml/qt.rb', line 11 def qt @qt ||= begin component = QML::Component.new data: <<-QML import QtQuick 2.0 QtObject { function getQt() { return Qt; } } QML component.create.getQt end end |
.run ⇒ Application
Creates an Application, yields it and then call QML::Application#exec.
73 74 75 76 77 78 79 |
# File 'lib/qml/application.rb', line 73 def run QML.init QML.application.tap do |app| yield app app.exec end end |