Class: QML::Application
- Inherits:
-
Object
- Object
- QML::Application
- Defined in:
- lib/qml/application.rb,
ext/qml/application.c
Overview
Application represents a Qt application instance. It provides the event loop and manages Application-level configurations.
Instance Method Summary collapse
- #domain=(name) ⇒ Object
-
#engine ⇒ Engine
The engine of the application.
-
#exec ⇒ Object
Starts the event loop of the application.
- #icon=(filename) ⇒ Object
-
#load(data: nil, path: nil) ⇒ Object
Loads a QML file.
-
#load_data(data) ⇒ Object
Loads a QML file from string data.
-
#load_path(path) ⇒ Object
Loads a QML file from a file path.
- #name=(name) ⇒ Object
- #organization=(name) ⇒ Object
-
#process_events ⇒ Object
Processes queued events in the event loop manually.
-
#quit ⇒ Object
Quits the application.
-
#root ⇒ Object
The root object created by the root component.
-
#root_component ⇒ Component
The root component of the application that represents the loaded QML file.
Instance Method Details
#domain=(name) ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'ext/qml/application.c', line 55
static VALUE application_domain(VALUE self, VALUE name) {
application_t *data;
Check_Type(name, T_STRING);
TypedData_Get_Struct(self, application_t, &data_type, data);
if (data->application) {
qmlbind_application_setorganizationdomain(RSTRING_PTR(name));
}
return self;
}
|
#engine ⇒ Engine
Returns The engine of the application.
9 10 11 |
# File 'lib/qml/application.rb', line 9 def engine QML.engine end |
#exec ⇒ Object
Starts the event loop of the application. This method never returns until the application quits.
109 110 111 112 113 |
# File 'ext/qml/application.c', line 109
static VALUE application_exec(VALUE self) {
qmlbind_application *app = rbqml_get_application(self);
int ret = (int)rb_thread_call_without_gvl((void *(*)(void *))&qmlbind_application_exec, app, RUBY_UBF_IO, NULL);
return INT2NUM(ret);
}
|
#icon=(filename) ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'ext/qml/application.c', line 66
static VALUE application_seticon(VALUE self, VALUE filename) {
application_t *data;
Check_Type(filename, T_STRING);
TypedData_Get_Struct(self, application_t, &data_type, data);
if (data->application) {
qmlbind_application_seticon(RSTRING_PTR(filename));
}
return self;
}
|
#load(data: nil, path: nil) ⇒ Object
Loads a QML file. The loaded component can be accessed by #root_component
25 26 27 28 |
# File 'lib/qml/application.rb', line 25 def load(data: nil, path: nil) @root_component = Component.new(data: data, path: path) @root = @root_component.create end |
#load_data(data) ⇒ Object
Loads a QML file from string data.
32 33 34 |
# File 'lib/qml/application.rb', line 32 def load_data(data) load(data: data) end |
#load_path(path) ⇒ Object
Loads a QML file from a file path.
38 39 40 |
# File 'lib/qml/application.rb', line 38 def load_path(path) load(path: path) end |
#name=(name) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'ext/qml/application.c', line 33
static VALUE application_name(VALUE self, VALUE name) {
application_t *data;
Check_Type(name, T_STRING);
TypedData_Get_Struct(self, application_t, &data_type, data);
if (data->application) {
qmlbind_application_setapplicationname(RSTRING_PTR(name));
}
return self;
}
|
#organization=(name) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'ext/qml/application.c', line 44
static VALUE application_organization(VALUE self, VALUE name) {
application_t *data;
Check_Type(name, T_STRING);
TypedData_Get_Struct(self, application_t, &data_type, data);
if (data->application) {
qmlbind_application_setorganizationname(RSTRING_PTR(name));
}
return self;
}
|
#process_events ⇒ Object
Processes queued events in the event loop manually. This method is useful when you are combining an external event loop like EventMachine.
119 120 121 122 |
# File 'ext/qml/application.c', line 119
static VALUE application_process_events(VALUE application) {
rb_thread_call_without_gvl((void *(*)(void *))&qmlbind_process_events, NULL, RUBY_UBF_IO, NULL);
return Qnil;
}
|
#quit ⇒ Object
Quits the application.
48 49 50 |
# File 'lib/qml/application.rb', line 48 def quit QML.qt.quit end |
#root ⇒ Object
Returns The root object created by the root component.
43 44 45 |
# File 'lib/qml/application.rb', line 43 def root @root or fail "QML data or file has not been loaded" end |
#root_component ⇒ Component
Returns The root component of the application that represents the loaded QML file.
17 18 19 |
# File 'lib/qml/application.rb', line 17 def root_component @root_component or fail ApplicationError, "QML data or file has not been loaded" end |