QML Widget Models
See the Qt Quick Widgets guide for an introduction and usage examples.
Vec2Model
Bases: QObject
Holds a Vec2 and exposes its components as QML properties.
Source code in ncca/ngl/qml/vec2_model.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
__init__(parent=None)
Initialize the model with a zero Vec2.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec2_model.py
18 19 20 21 22 23 24 25 | |
get_value()
Return the current Vec2 value.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec2_model.py
64 65 66 67 68 69 70 71 | |
get_x()
Return the x component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec2_model.py
27 28 29 30 31 32 33 | |
get_y()
Return the y component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec2_model.py
44 45 46 47 48 49 50 | |
set_value(value)
Replace the current value and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec2_model.py
73 74 75 76 77 78 79 80 81 | |
set_x(value)
Set the x component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec2_model.py
35 36 37 38 39 40 41 42 | |
set_y(value)
Set the y component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec2_model.py
52 53 54 55 56 57 58 59 | |
Vec3Model
Bases: QObject
Holds a Vec3 and exposes its components as QML properties.
Source code in ncca/ngl/qml/vec3_model.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
__init__(parent=None)
Initialize the model with a zero Vec3.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
18 19 20 21 22 23 24 25 | |
get_value()
Return the current Vec3 value.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
82 83 84 85 86 87 88 89 | |
get_x()
Return the x component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
27 28 29 30 31 32 33 | |
get_y()
Return the y component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
44 45 46 47 48 49 50 | |
get_z()
Return the z component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
61 62 63 64 65 66 67 | |
set_value(value)
Replace the current value and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
91 92 93 94 95 96 97 98 99 | |
set_x(value)
Set the x component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
35 36 37 38 39 40 41 42 | |
set_y(value)
Set the y component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
52 53 54 55 56 57 58 59 | |
set_z(value)
Set the z component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec3_model.py
69 70 71 72 73 74 75 76 | |
Vec4Model
Bases: QObject
Holds a Vec4 and exposes its components as QML properties.
Source code in ncca/ngl/qml/vec4_model.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__init__(parent=None)
Initialize the model with a zero Vec4.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
18 19 20 21 22 23 24 25 | |
get_value()
Return the current Vec4 value.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
100 101 102 103 104 105 106 107 | |
get_w()
Return the w component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
78 79 80 81 82 83 84 | |
get_x()
Return the x component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
27 28 29 30 31 32 33 | |
get_y()
Return the y component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
44 45 46 47 48 49 50 | |
get_z()
Return the z component.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
61 62 63 64 65 66 67 | |
set_value(value)
Replace the current value and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
109 110 111 112 113 114 115 116 117 | |
set_w(value)
Set the w component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
86 87 88 89 90 91 92 93 | |
set_x(value)
Set the x component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
35 36 37 38 39 40 41 42 | |
set_y(value)
Set the y component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
52 53 54 55 56 57 58 59 | |
set_z(value)
Set the z component and emit valueChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/vec4_model.py
69 70 71 72 73 74 75 76 | |
TransformModel
Bases: QObject
Combines position/rotation/scale Vec3Models into a Mat4 transform.
Source code in ncca/ngl/qml/transform_model.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
__init__(parent=None)
Initialize child position/rotation/scale models and compute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
get_matrix()
Return the current transform matrix.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
114 115 116 117 118 119 120 121 | |
get_position()
Return the position child model.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
42 43 44 45 46 47 48 | |
get_rotation()
Return the rotation child model.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
50 51 52 53 54 55 56 | |
get_rotation_order_index()
Return the index into ROTATION_ORDERS currently in use.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
70 71 72 73 74 75 76 | |
get_scale()
Return the scale child model.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
58 59 60 61 62 63 64 | |
matrix_text()
Return the current matrix formatted as a readable multi-line string.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
125 126 127 128 129 130 131 132 133 134 135 | |
rotation_orders()
Return the ordered list of valid rotation order strings.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
91 92 93 94 95 96 97 98 | |
set_rotation_order_index(index)
Set the rotation order by index and recompute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/transform_model.py
78 79 80 81 82 83 84 85 | |
LookAtModel
Bases: QObject
Combines eye/look Vec3Models and a world-up choice into a view Mat4.
Source code in ncca/ngl/qml/lookat_model.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
__init__(parent=None)
Initialize eye/look child models and compute the initial view matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
get_eye()
Return the eye child model.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
41 42 43 44 45 46 47 | |
get_look()
Return the look-at child model.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
49 50 51 52 53 54 55 | |
get_matrix()
Return the current view matrix.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
96 97 98 99 100 101 102 103 | |
get_up_index()
Return the index into WORLD_UP currently in use.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
60 61 62 63 64 65 66 | |
matrix_text()
Return the current matrix formatted as a readable multi-line string.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
107 108 109 110 111 112 113 114 115 116 117 | |
set_up_index(index)
Set the world-up vector by index and recompute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
68 69 70 71 72 73 74 75 | |
up_names()
Return the ordered list of world-up display names.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/lookat_model.py
79 80 81 82 83 84 85 86 | |
PerspectiveModel
Bases: QObject
Combines fov/aspect/near/far and a clip-space mode into a perspective Mat4.
Source code in ncca/ngl/qml/perspective_model.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
__init__(parent=None)
Initialize the model with default projection parameters.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
get_aspect()
Return the aspect ratio.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
55 56 57 58 59 60 61 | |
get_far()
Return the far clipping plane distance.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
93 94 95 96 97 98 99 | |
get_fov()
Return the field of view in degrees.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
36 37 38 39 40 41 42 | |
get_matrix()
Return the current perspective matrix.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
147 148 149 150 151 152 153 154 | |
get_mode_index()
Return the index into MODE_NAMES currently in use.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
112 113 114 115 116 117 118 | |
get_near()
Return the near clipping plane distance.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
74 75 76 77 78 79 80 | |
matrix_text()
Return the current matrix formatted as a readable multi-line string.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
158 159 160 161 162 163 164 165 166 167 168 | |
mode_names()
Return the ordered list of clip-space mode display names.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
131 132 133 134 135 136 137 138 | |
set_aspect(value)
Set the aspect ratio and recompute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
63 64 65 66 67 68 69 70 | |
set_far(value)
Set the far clipping plane distance and recompute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
101 102 103 104 105 106 107 108 | |
set_fov(value)
Set the field of view and recompute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
44 45 46 47 48 49 50 51 | |
set_mode_index(index)
Set the clip-space mode by index and recompute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
120 121 122 123 124 125 126 127 | |
set_near(value)
Set the near clipping plane distance and recompute the matrix.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/perspective_model.py
82 83 84 85 86 87 88 89 | |
RGBColourModel
Bases: QObject
Holds an RGB Vec3 colour and exposes r/g/b plus a hex swatch colour.
Source code in ncca/ngl/qml/rgb_colour_model.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
__init__(parent=None)
Initialize the model with white (1, 1, 1).
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
19 20 21 22 23 24 25 26 | |
get_b()
Return the blue channel.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
62 63 64 65 66 67 68 | |
get_g()
Return the green channel.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
45 46 47 48 49 50 51 | |
get_hex()
Return the colour as a #RRGGBB hex string.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
83 84 85 86 87 88 89 | |
get_r()
Return the red channel.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
28 29 30 31 32 33 34 | |
get_value()
Return the current colour as a Vec3.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
93 94 95 96 97 98 99 100 | |
set_b(value)
Set the blue channel and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
70 71 72 73 74 75 76 77 | |
set_g(value)
Set the green channel and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
53 54 55 56 57 58 59 60 | |
set_r(value)
Set the red channel and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
36 37 38 39 40 41 42 43 | |
set_value(value)
Replace the current colour and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgb_colour_model.py
102 103 104 105 106 107 108 109 110 | |
RGBAColourModel
Bases: QObject
Holds an RGBA Vec4 colour and exposes r/g/b/a plus a hex swatch colour.
Source code in ncca/ngl/qml/rgba_colour_model.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
__init__(parent=None)
Initialize the model with opaque white (1, 1, 1, 1).
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
19 20 21 22 23 24 25 26 | |
get_a()
Return the alpha channel.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
79 80 81 82 83 84 85 | |
get_b()
Return the blue channel.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
62 63 64 65 66 67 68 | |
get_g()
Return the green channel.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
45 46 47 48 49 50 51 | |
get_hex()
Return the colour as a #AARRGGBB hex string.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
101 102 103 104 105 106 107 108 109 110 | |
get_r()
Return the red channel.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
28 29 30 31 32 33 34 | |
get_value()
Return the current colour as a Vec4.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
114 115 116 117 118 119 120 121 | |
set_a(value)
Set the alpha channel and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
87 88 89 90 91 92 93 94 | |
set_b(value)
Set the blue channel and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
70 71 72 73 74 75 76 77 | |
set_g(value)
Set the green channel and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
53 54 55 56 57 58 59 60 | |
set_r(value)
Set the red channel and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
36 37 38 39 40 41 42 43 | |
set_value(value)
Replace the current colour and emit colourChanged.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/rgba_colour_model.py
123 124 125 126 127 128 129 130 131 | |
Mat2Model
Bases: MatGridModel
Grid model for a Mat2. No rotate/scale method combo (mirrors Mat2Widget).
Source code in ncca/ngl/qml/mat2_model.py
13 14 15 16 17 18 | |
Mat3Model
Bases: MatGridModel
Grid model for a Mat3, with a rotate/scale method combo.
Source code in ncca/ngl/qml/mat3_model.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
apply_angle_method(name, degrees)
Apply an angle-based method (rotate_x/y/z) by degrees.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/mat3_model.py
49 50 51 52 53 54 55 56 57 58 | |
apply_xyz_method(name, x, y, z)
Apply an xyz-based method (scale) with the given components.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/mat3_model.py
60 61 62 63 64 65 66 67 68 69 70 71 | |
method_kind(name)
Return the parameter kind for a method name.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in ncca/ngl/qml/mat3_model.py
37 38 39 40 41 42 43 44 45 46 47 | |
method_names()
Return the ordered list of available method names for the combo box.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/mat3_model.py
28 29 30 31 32 33 34 35 | |
Mat4Model
Bases: MatGridModel
Grid model for a Mat4, with a rotate/scale/translate method combo.
Source code in ncca/ngl/qml/mat4_model.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
apply_angle_method(name, degrees)
Apply an angle-based method (rotate_x/y/z) by degrees.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/mat4_model.py
50 51 52 53 54 55 56 57 58 59 | |
apply_xyz_method(name, x, y, z)
Apply an xyz-based method (scale/translate) with the given components.
| Parameters: |
|
|---|
Source code in ncca/ngl/qml/mat4_model.py
61 62 63 64 65 66 67 68 69 70 71 72 | |
method_kind(name)
Return the parameter kind for a method name.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in ncca/ngl/qml/mat4_model.py
38 39 40 41 42 43 44 45 46 47 48 | |
method_names()
Return the ordered list of available method names for the combo box.
| Returns: |
|
|---|
Source code in ncca/ngl/qml/mat4_model.py
29 30 31 32 33 34 35 36 | |
Import path helpers
ncca.ngl.qml is a file-based QML module, so an engine needs its import
path set before import ncca.ngl.qml 1.0 will resolve from your own
.qml files.
add_import_path
Register ncca.ngl.qml's import path on a QML engine.
Call this once after constructing the engine so that import ncca.ngl.qml
resolves in your own .qml files. Works for both QQmlApplicationEngine
and QQuickWidget.engine() (both are QQmlEngine).
Source code in ncca/ngl/qml/__init__.py
60 61 62 63 64 65 66 67 | |
import_path
Return the directory to add to a QML engine's import path.
ncca.ngl.qml is a file-based QML module whose qmldir declares
module ncca.ngl.qml, so import ncca.ngl.qml 1.0 only resolves from
an external .qml file if the engine's import path is the directory that
contains the ncca/ package (parents[3] of this file:
qml -> ngl -> ncca -> containing dir), not the qml/ leaf directory.
This is derived from the module file rather than ncca.__file__ because
ncca is a PEP 420 namespace package and so has no __file__.
Source code in ncca/ngl/qml/__init__.py
45 46 47 48 49 50 51 52 53 54 55 56 57 | |