zui 0.0.1
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.
- checksums.yaml +7 -0
- data/Components/Builtins/Accordion.qml +208 -0
- data/Components/Builtins/Action.qml +43 -0
- data/Components/Builtins/ActionButton.qml +19 -0
- data/Components/Builtins/ActionGroup.qml +81 -0
- data/Components/Builtins/AlertDialog.qml +398 -0
- data/Components/Builtins/AnchorAnimation.qml +3 -0
- data/Components/Builtins/AnchorChanges.qml +11 -0
- data/Components/Builtins/AnimatedImage.qml +39 -0
- data/Components/Builtins/Animation.qml +3 -0
- data/Components/Builtins/AnimationController.qml +11 -0
- data/Components/Builtins/ApplicationWindow.qml +103 -0
- data/Components/Builtins/AreaChart.qml +70 -0
- data/Components/Builtins/AspectRatio.qml +30 -0
- data/Components/Builtins/Audio.qml +85 -0
- data/Components/Builtins/AudioInput.qml +10 -0
- data/Components/Builtins/AudioOutput.qml +10 -0
- data/Components/Builtins/Avatar.qml +46 -0
- data/Components/Builtins/Badge.qml +38 -0
- data/Components/Builtins/Banner.qml +133 -0
- data/Components/Builtins/BarChart.qml +67 -0
- data/Components/Builtins/BarIconButton.qml +30 -0
- data/Components/Builtins/BarIndicator.qml +26 -0
- data/Components/Builtins/Behavior.qml +13 -0
- data/Components/Builtins/Blur.qml +14 -0
- data/Components/Builtins/BorderImage.qml +38 -0
- data/Components/Builtins/BorderOverlay.qml +25 -0
- data/Components/Builtins/BottomSheet.qml +211 -0
- data/Components/Builtins/Breadcrumb.qml +169 -0
- data/Components/Builtins/BubbleChart.qml +3 -0
- data/Components/Builtins/BusyIndicator.qml +24 -0
- data/Components/Builtins/Button.qml +55 -0
- data/Components/Builtins/ButtonGroup.qml +18 -0
- data/Components/Builtins/Calendar.qml +55 -0
- data/Components/Builtins/Camera.qml +18 -0
- data/Components/Builtins/CandlestickChart.qml +3 -0
- data/Components/Builtins/Canvas.qml +159 -0
- data/Components/Builtins/CaptureSession.qml +19 -0
- data/Components/Builtins/Card.qml +23 -0
- data/Components/Builtins/Carousel.qml +72 -0
- data/Components/Builtins/Center.qml +20 -0
- data/Components/Builtins/CheckDelegate.qml +132 -0
- data/Components/Builtins/Checkbox.qml +62 -0
- data/Components/Builtins/Chip.qml +65 -0
- data/Components/Builtins/Circle.qml +35 -0
- data/Components/Builtins/Clipboard.qml +29 -0
- data/Components/Builtins/ColorAnimation.qml +3 -0
- data/Components/Builtins/ColorPicker.qml +70 -0
- data/Components/Builtins/Colorize.qml +14 -0
- data/Components/Builtins/Column.qml +17 -0
- data/Components/Builtins/ColumnLayout.qml +13 -0
- data/Components/Builtins/ConfirmDialog.qml +20 -0
- data/Components/Builtins/ConstrainedBox.qml +28 -0
- data/Components/Builtins/Container.qml +30 -0
- data/Components/Builtins/ContextMenu.qml +140 -0
- data/Components/Builtins/CursorSurface.qml +18 -0
- data/Components/Builtins/DataTable.qml +69 -0
- data/Components/Builtins/DatePicker.qml +180 -0
- data/Components/Builtins/DayOfWeekRow.qml +11 -0
- data/Components/Builtins/DelayButton.qml +47 -0
- data/Components/Builtins/DelegateModel.qml +10 -0
- data/Components/Builtins/DelegateModelGroup.qml +10 -0
- data/Components/Builtins/Dial.qml +42 -0
- data/Components/Builtins/Dialog.qml +128 -0
- data/Components/Builtins/DialogButtonBox.qml +137 -0
- data/Components/Builtins/Divider.qml +26 -0
- data/Components/Builtins/DonutChart.qml +3 -0
- data/Components/Builtins/DoubleSpinBox.qml +58 -0
- data/Components/Builtins/DragArea.qml +43 -0
- data/Components/Builtins/Drawer.qml +107 -0
- data/Components/Builtins/DropArea.qml +19 -0
- data/Components/Builtins/DropShadow.qml +16 -0
- data/Components/Builtins/Dropdown.qml +19 -0
- data/Components/Builtins/ExpansionPanel.qml +157 -0
- data/Components/Builtins/FilePicker.qml +140 -0
- data/Components/Builtins/FittedBox.qml +40 -0
- data/Components/Builtins/Flickable.qml +40 -0
- data/Components/Builtins/Flipable.qml +45 -0
- data/Components/Builtins/Flow.qml +16 -0
- data/Components/Builtins/FocusScope.qml +29 -0
- data/Components/Builtins/FolderListModel.qml +9 -0
- data/Components/Builtins/FolderPicker.qml +93 -0
- data/Components/Builtins/FontLoader.qml +21 -0
- data/Components/Builtins/FontPicker.qml +91 -0
- data/Components/Builtins/Frame.qml +71 -0
- data/Components/Builtins/FrameAnimation.qml +13 -0
- data/Components/Builtins/Gauge.qml +3 -0
- data/Components/Builtins/Glow.qml +15 -0
- data/Components/Builtins/Gradient.qml +93 -0
- data/Components/Builtins/Grid.qml +16 -0
- data/Components/Builtins/GridLayout.qml +16 -0
- data/Components/Builtins/GridView.qml +226 -0
- data/Components/Builtins/GroupBox.qml +95 -0
- data/Components/Builtins/Heatmap.qml +3 -0
- data/Components/Builtins/Histogram.qml +3 -0
- data/Components/Builtins/HorizontalHeader.qml +23 -0
- data/Components/Builtins/HorizontalHeaderDelegate.qml +39 -0
- data/Components/Builtins/HoverArea.qml +19 -0
- data/Components/Builtins/Icon.qml +16 -0
- data/Components/Builtins/Image.qml +110 -0
- data/Components/Builtins/ImageCapture.qml +14 -0
- data/Components/Builtins/ItemDelegate.qml +152 -0
- data/Components/Builtins/KeyCatcher.qml +25 -0
- data/Components/Builtins/Label.qml +43 -0
- data/Components/Builtins/LayoutItemProxy.qml +51 -0
- data/Components/Builtins/Legend.qml +86 -0
- data/Components/Builtins/Line.qml +28 -0
- data/Components/Builtins/LineChart.qml +87 -0
- data/Components/Builtins/ListModel.qml +8 -0
- data/Components/Builtins/ListView.qml +65 -0
- data/Components/Builtins/Loader.qml +33 -0
- data/Components/Builtins/Markdown.qml +23 -0
- data/Components/Builtins/MediaDevices.qml +10 -0
- data/Components/Builtins/MediaPlayer.qml +27 -0
- data/Components/Builtins/MediaRecorder.qml +16 -0
- data/Components/Builtins/Menu.qml +119 -0
- data/Components/Builtins/MenuBar.qml +128 -0
- data/Components/Builtins/MenuItem.qml +77 -0
- data/Components/Builtins/MenuSeparator.qml +30 -0
- data/Components/Builtins/MessageDialog.qml +104 -0
- data/Components/Builtins/ModalSheet.qml +222 -0
- data/Components/Builtins/ModelView3d.qml +50 -0
- data/Components/Builtins/MonthGrid.qml +23 -0
- data/Components/Builtins/MultiEffect.qml +48 -0
- data/Components/Builtins/MultiSelect.qml +23 -0
- data/Components/Builtins/NavigationRail.qml +154 -0
- data/Components/Builtins/NumberAnimation.qml +3 -0
- data/Components/Builtins/NumberField.qml +18 -0
- data/Components/Builtins/OpacityAnimator.qml +3 -0
- data/Components/Builtins/OpacityMask.qml +21 -0
- data/Components/Builtins/OpticalGlyph.qml +16 -0
- data/Components/Builtins/Page.qml +111 -0
- data/Components/Builtins/PageIndicator.qml +63 -0
- data/Components/Builtins/Pagination.qml +158 -0
- data/Components/Builtins/Pane.qml +72 -0
- data/Components/Builtins/PanelHero.qml +15 -0
- data/Components/Builtins/ParallelAnimation.qml +3 -0
- data/Components/Builtins/ParentAnimation.qml +3 -0
- data/Components/Builtins/ParentChange.qml +10 -0
- data/Components/Builtins/ParticleSystem.qml +81 -0
- data/Components/Builtins/PasswordField.qml +58 -0
- data/Components/Builtins/Path.qml +35 -0
- data/Components/Builtins/PathAnimation.qml +3 -0
- data/Components/Builtins/PauseAnimation.qml +3 -0
- data/Components/Builtins/PieChart.qml +3 -0
- data/Components/Builtins/PinchArea.qml +23 -0
- data/Components/Builtins/Popup.qml +130 -0
- data/Components/Builtins/Progress.qml +15 -0
- data/Components/Builtins/ProgressRing.qml +120 -0
- data/Components/Builtins/PropertyAction.qml +11 -0
- data/Components/Builtins/PropertyAnimation.qml +3 -0
- data/Components/Builtins/PropertyChanges.qml +10 -0
- data/Components/Builtins/RadarChart.qml +3 -0
- data/Components/Builtins/RadialGauge.qml +3 -0
- data/Components/Builtins/RadioButton.qml +46 -0
- data/Components/Builtins/RadioDelegate.qml +115 -0
- data/Components/Builtins/RadioGroup.qml +58 -0
- data/Components/Builtins/RangeSlider.qml +39 -0
- data/Components/Builtins/Rectangle.qml +23 -0
- data/Components/Builtins/RectangularShadow.qml +23 -0
- data/Components/Builtins/ReorderableList.qml +204 -0
- data/Components/Builtins/RichText.qml +23 -0
- data/Components/Builtins/RotationAnimation.qml +3 -0
- data/Components/Builtins/RotationAnimator.qml +3 -0
- data/Components/Builtins/RoundButton.qml +42 -0
- data/Components/Builtins/Row.qml +17 -0
- data/Components/Builtins/RowLayout.qml +13 -0
- data/Components/Builtins/ScaleAnimator.qml +3 -0
- data/Components/Builtins/ScatterChart.qml +3 -0
- data/Components/Builtins/ScreenCapture.qml +78 -0
- data/Components/Builtins/ScriptAction.qml +15 -0
- data/Components/Builtins/Scroll.qml +18 -0
- data/Components/Builtins/ScrollBar.qml +18 -0
- data/Components/Builtins/ScrollIndicator.qml +15 -0
- data/Components/Builtins/SearchField.qml +178 -0
- data/Components/Builtins/SearchableDropdown.qml +21 -0
- data/Components/Builtins/SectionHeader.qml +14 -0
- data/Components/Builtins/SelectableText.qml +33 -0
- data/Components/Builtins/SelectionRectangle.qml +17 -0
- data/Components/Builtins/Separator.qml +13 -0
- data/Components/Builtins/SequentialAnimation.qml +3 -0
- data/Components/Builtins/Settings.qml +10 -0
- data/Components/Builtins/ShaderEffect.qml +115 -0
- data/Components/Builtins/ShaderEffectSource.qml +61 -0
- data/Components/Builtins/Shaders/grayscale.frag +14 -0
- data/Components/Builtins/Shaders/grayscale.frag.qsb +0 -0
- data/Components/Builtins/Shaders/passthrough.frag +11 -0
- data/Components/Builtins/Shaders/passthrough.frag.qsb +0 -0
- data/Components/Builtins/Shaders/pixelate.frag +16 -0
- data/Components/Builtins/Shaders/pixelate.frag.qsb +0 -0
- data/Components/Builtins/Shaders/vignette.frag +18 -0
- data/Components/Builtins/Shaders/vignette.frag.qsb +0 -0
- data/Components/Builtins/Shaders/wave.frag +18 -0
- data/Components/Builtins/Shaders/wave.frag.qsb +0 -0
- data/Components/Builtins/Shape.qml +53 -0
- data/Components/Builtins/Skeleton.qml +78 -0
- data/Components/Builtins/Slider.qml +21 -0
- data/Components/Builtins/SmoothedAnimation.qml +3 -0
- data/Components/Builtins/Snackbar.qml +181 -0
- data/Components/Builtins/SortFilterProxyModel.qml +16 -0
- data/Components/Builtins/SoundEffect.qml +10 -0
- data/Components/Builtins/Spacer.qml +13 -0
- data/Components/Builtins/Sparkline.qml +3 -0
- data/Components/Builtins/SpinBox.qml +44 -0
- data/Components/Builtins/SplitView.qml +31 -0
- data/Components/Builtins/SpringAnimation.qml +3 -0
- data/Components/Builtins/Stack.qml +14 -0
- data/Components/Builtins/StackLayout.qml +19 -0
- data/Components/Builtins/StackView.qml +122 -0
- data/Components/Builtins/StackedBarChart.qml +3 -0
- data/Components/Builtins/StandardPaths.qml +9 -0
- data/Components/Builtins/State.qml +13 -0
- data/Components/Builtins/StateGroup.qml +11 -0
- data/Components/Builtins/Support/AnimationDriver.qml +79 -0
- data/Components/Builtins/Support/AnimationGroupDriver.qml +32 -0
- data/Components/Builtins/Support/ChartCanvas.qml +629 -0
- data/Components/Builtins/Support/ModelView3dScene.qml +292 -0
- data/Components/Builtins/Support/OptionalModuleState.js +5 -0
- data/Components/Builtins/SwipeDelegate.qml +231 -0
- data/Components/Builtins/SwipeView.qml +69 -0
- data/Components/Builtins/SwitchDelegate.qml +140 -0
- data/Components/Builtins/TabBar.qml +117 -0
- data/Components/Builtins/TabButton.qml +105 -0
- data/Components/Builtins/TableView.qml +388 -0
- data/Components/Builtins/TableViewDelegate.qml +17 -0
- data/Components/Builtins/Tabs.qml +138 -0
- data/Components/Builtins/Text.qml +24 -0
- data/Components/Builtins/TextArea.qml +59 -0
- data/Components/Builtins/TextField.qml +21 -0
- data/Components/Builtins/TextMetrics.qml +39 -0
- data/Components/Builtins/TimePicker.qml +213 -0
- data/Components/Builtins/Timer.qml +13 -0
- data/Components/Builtins/Toast.qml +213 -0
- data/Components/Builtins/Toggle.qml +19 -0
- data/Components/Builtins/ToggleSwitch.qml +22 -0
- data/Components/Builtins/ToolBar.qml +61 -0
- data/Components/Builtins/ToolButton.qml +41 -0
- data/Components/Builtins/ToolSeparator.qml +36 -0
- data/Components/Builtins/Tooltip.qml +20 -0
- data/Components/Builtins/Transition.qml +3 -0
- data/Components/Builtins/TreeView.qml +423 -0
- data/Components/Builtins/TreeViewDelegate.qml +46 -0
- data/Components/Builtins/Tumbler.qml +18 -0
- data/Components/Builtins/UniformAnimator.qml +3 -0
- data/Components/Builtins/VectorAnimation.qml +3 -0
- data/Components/Builtins/VectorImage.qml +62 -0
- data/Components/Builtins/VerticalHeader.qml +21 -0
- data/Components/Builtins/VerticalHeaderDelegate.qml +35 -0
- data/Components/Builtins/Video.qml +54 -0
- data/Components/Builtins/VideoOutput.qml +54 -0
- data/Components/Builtins/WebView.qml +57 -0
- data/Components/Builtins/WeekNumberColumn.qml +13 -0
- data/Components/Builtins/WidgetButton.qml +26 -0
- data/Components/Builtins/Window.qml +90 -0
- data/Components/Builtins/WindowCapture.qml +11 -0
- data/Components/Builtins/Wrap.qml +18 -0
- data/Components/Builtins/XAnimator.qml +3 -0
- data/Components/Builtins/YAnimator.qml +3 -0
- data/Components/README.md +45 -0
- data/ControlNode.qml +1369 -0
- data/Controls/BarIconButton.qml +27 -0
- data/Controls/BarIndicator.qml +22 -0
- data/Controls/BorderOverlay.qml +10 -0
- data/Controls/BorderSurface.qml +10 -0
- data/Controls/Button.qml +78 -0
- data/Controls/ButtonGroup.qml +19 -0
- data/Controls/ConfirmDialog.qml +37 -0
- data/Controls/CursorSurface.qml +29 -0
- data/Controls/Dropdown.qml +59 -0
- data/Controls/MultiSelect.qml +32 -0
- data/Controls/NumberField.qml +24 -0
- data/Controls/OpticalGlyph.qml +14 -0
- data/Controls/PanelActionButton.qml +10 -0
- data/Controls/PanelHero.qml +18 -0
- data/Controls/PanelKeyCatcher.qml +25 -0
- data/Controls/PanelSectionHeader.qml +11 -0
- data/Controls/PanelSeparator.qml +10 -0
- data/Controls/PanelSlider.qml +36 -0
- data/Controls/PanelToolTip.qml +13 -0
- data/Controls/SearchableDropdown.qml +11 -0
- data/Controls/TextField.qml +25 -0
- data/Controls/Toggle.qml +22 -0
- data/Controls/ToggleSwitch.qml +26 -0
- data/Controls/WidgetButton.qml +35 -0
- data/Controls/qmldir +25 -0
- data/Desktop.qml +76 -0
- data/LICENSE +22 -0
- data/README.md +112 -0
- data/Service.qml +430 -0
- data/Theme/Border.qml +22 -0
- data/Theme/Color.qml +22 -0
- data/Theme/Style.qml +47 -0
- data/Theme/Util.qml +6 -0
- data/Theme/qmldir +5 -0
- data/bin/zui +7 -0
- data/lib/zui/animation.rb +24 -0
- data/lib/zui/application.rb +327 -0
- data/lib/zui/builder.rb +725 -0
- data/lib/zui/cli.rb +91 -0
- data/lib/zui/command.rb +101 -0
- data/lib/zui/component_registry.rb +91 -0
- data/lib/zui/components.rb +262 -0
- data/lib/zui/distribution.rb +200 -0
- data/lib/zui/generator.rb +84 -0
- data/lib/zui/host.rb +123 -0
- data/lib/zui/node.rb +30 -0
- data/lib/zui/platform.rb +40 -0
- data/lib/zui/protocol.rb +29 -0
- data/lib/zui/runner.rb +37 -0
- data/lib/zui/runtime.rb +23 -0
- data/lib/zui/scheduler.rb +136 -0
- data/lib/zui/source_bundle.rb +63 -0
- data/lib/zui/state_store.rb +100 -0
- data/lib/zui/value.rb +44 -0
- data/lib/zui.rb +33 -0
- data/native/CMakeLists.txt +45 -0
- data/native/ZuiClipboard.cpp +16 -0
- data/native/ZuiClipboard.h +16 -0
- data/native/ZuiProcess.cpp +84 -0
- data/native/ZuiProcess.h +34 -0
- data/native/main.cpp +64 -0
- data/vendor/host/linux-x86_64/PROVENANCE.md +15 -0
- data/vendor/host/linux-x86_64/zui-host +0 -0
- data/vendor/host/linux-x86_64/zui-host.sha256 +1 -0
- metadata +365 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick3D
|
|
3
|
+
import QtQuick3D.AssetUtils
|
|
4
|
+
|
|
5
|
+
Item {
|
|
6
|
+
id: modelViewRoot
|
|
7
|
+
|
|
8
|
+
required property var renderer
|
|
9
|
+
property real currentPitch: Number(renderer.prop("rotation_x", 0))
|
|
10
|
+
property real currentYaw: Number(renderer.prop("rotation_y", 0))
|
|
11
|
+
property real currentRoll: Number(renderer.prop("rotation_z", 0))
|
|
12
|
+
property real currentZoom: clampZoom(Number(renderer.prop("zoom", 1)))
|
|
13
|
+
property real automaticYaw: 0
|
|
14
|
+
property real fittedScale: 1
|
|
15
|
+
property real boundsDiameter: 0
|
|
16
|
+
property vector3d modelCenter: Qt.vector3d(0, 0, 0)
|
|
17
|
+
property real observedResetRevision: Number(renderer.prop("reset_revision", 0))
|
|
18
|
+
property bool ready: false
|
|
19
|
+
property string loadedModelSource: ""
|
|
20
|
+
|
|
21
|
+
function clampZoom(value) {
|
|
22
|
+
return Math.max(Number(renderer.prop("minimum_zoom", 0.65)), Math.min(Number(renderer.prop("maximum_zoom", 3.2)), Number(value)));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function event(name, payload) {
|
|
26
|
+
if (renderer.subscribed(name))
|
|
27
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, name, payload || {
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function sendRotation() {
|
|
33
|
+
event("rotation_change", {
|
|
34
|
+
"x": currentPitch,
|
|
35
|
+
"y": currentYaw,
|
|
36
|
+
"z": currentRoll
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function setZoom(value, notify) {
|
|
41
|
+
currentZoom = clampZoom(value);
|
|
42
|
+
if (notify)
|
|
43
|
+
event("zoom_change", {
|
|
44
|
+
"value": currentZoom
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function resetView(notify) {
|
|
50
|
+
currentPitch = Number(renderer.prop("rotation_x", 0));
|
|
51
|
+
currentYaw = Number(renderer.prop("rotation_y", 0));
|
|
52
|
+
currentRoll = Number(renderer.prop("rotation_z", 0));
|
|
53
|
+
setZoom(Number(renderer.prop("zoom", 1)), notify);
|
|
54
|
+
if (notify)
|
|
55
|
+
sendRotation();
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function updateBounds() {
|
|
60
|
+
var bounds = runtimeModel.bounds;
|
|
61
|
+
var size = Qt.vector3d(bounds.maximum.x - bounds.minimum.x, bounds.maximum.y - bounds.minimum.y, bounds.maximum.z - bounds.minimum.z);
|
|
62
|
+
var diameter = Math.max(size.x, size.y, size.z);
|
|
63
|
+
boundsDiameter = diameter;
|
|
64
|
+
if (!isFinite(diameter) || diameter <= 0) {
|
|
65
|
+
fittedScale = Number(renderer.prop("model_scale", 1));
|
|
66
|
+
modelCenter = Qt.vector3d(Number(renderer.prop("center_x", 0)), Number(renderer.prop("center_y", 0)), Number(renderer.prop("center_z", 0)));
|
|
67
|
+
return ;
|
|
68
|
+
}
|
|
69
|
+
modelCenter = Qt.vector3d((bounds.maximum.x + bounds.minimum.x) / 2, (bounds.maximum.y + bounds.minimum.y) / 2, (bounds.maximum.z + bounds.minimum.z) / 2);
|
|
70
|
+
var requestedScale = Number(renderer.prop("model_scale", 0));
|
|
71
|
+
fittedScale = requestedScale > 0 ? requestedScale : Number(renderer.prop("fit_size", 230)) / diameter;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function syncFromRenderer() {
|
|
75
|
+
var revision = Number(renderer.prop("reset_revision", 0));
|
|
76
|
+
if (revision !== observedResetRevision) {
|
|
77
|
+
observedResetRevision = revision;
|
|
78
|
+
resetView(false);
|
|
79
|
+
return ;
|
|
80
|
+
}
|
|
81
|
+
if (!orbitDrag.active) {
|
|
82
|
+
currentPitch = Number(renderer.prop("rotation_x", currentPitch));
|
|
83
|
+
currentYaw = Number(renderer.prop("rotation_y", currentYaw));
|
|
84
|
+
currentRoll = Number(renderer.prop("rotation_z", currentRoll));
|
|
85
|
+
}
|
|
86
|
+
if (!zoomPinch.active)
|
|
87
|
+
setZoom(Number(renderer.prop("zoom", currentZoom)), false);
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function synchronizeModelSource() {
|
|
92
|
+
var requestedSource = String(renderer.assetUrl(renderer.prop("source", "")));
|
|
93
|
+
if (requestedSource === loadedModelSource)
|
|
94
|
+
return ;
|
|
95
|
+
|
|
96
|
+
ready = false;
|
|
97
|
+
loadedModelSource = requestedSource;
|
|
98
|
+
runtimeModel.source = requestedSource;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
implicitWidth: Number(renderer.prop("width", 420))
|
|
102
|
+
implicitHeight: Number(renderer.prop("height", 420))
|
|
103
|
+
clip: true
|
|
104
|
+
Component.onCompleted: {
|
|
105
|
+
synchronizeModelSource();
|
|
106
|
+
syncFromRenderer();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Rectangle {
|
|
110
|
+
anchors.fill: parent
|
|
111
|
+
color: renderer.prop("background", "transparent")
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
View3D {
|
|
115
|
+
id: scene
|
|
116
|
+
|
|
117
|
+
anchors.fill: parent
|
|
118
|
+
|
|
119
|
+
PerspectiveCamera {
|
|
120
|
+
id: camera
|
|
121
|
+
|
|
122
|
+
z: Number(renderer.prop("camera_distance", 460))
|
|
123
|
+
fieldOfView: Number(renderer.prop("field_of_view", 36))
|
|
124
|
+
clipNear: 0.5
|
|
125
|
+
clipFar: 5000
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
DirectionalLight {
|
|
129
|
+
eulerRotation: Qt.vector3d(-28, -34, 0)
|
|
130
|
+
color: renderer.prop("key_light_color", "#ffffff")
|
|
131
|
+
brightness: Number(renderer.prop("light_brightness", 1.35))
|
|
132
|
+
castsShadow: true
|
|
133
|
+
shadowFactor: 70
|
|
134
|
+
shadowMapQuality: Light.ShadowMapQualityHigh
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
PointLight {
|
|
138
|
+
position: Qt.vector3d(-180, 90, 240)
|
|
139
|
+
color: renderer.prop("fill_light_color", "#ffffff")
|
|
140
|
+
brightness: Number(renderer.prop("light_brightness", 1.35)) * 5
|
|
141
|
+
quadraticFade: 2e-05
|
|
142
|
+
linearFade: 0.003
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
Node {
|
|
146
|
+
id: orbitNode
|
|
147
|
+
|
|
148
|
+
eulerRotation: Qt.vector3d(modelViewRoot.currentPitch, modelViewRoot.currentYaw + modelViewRoot.automaticYaw, modelViewRoot.currentRoll)
|
|
149
|
+
scale: Qt.vector3d(modelViewRoot.fittedScale * modelViewRoot.currentZoom, modelViewRoot.fittedScale * modelViewRoot.currentZoom, modelViewRoot.fittedScale * modelViewRoot.currentZoom)
|
|
150
|
+
|
|
151
|
+
RuntimeLoader {
|
|
152
|
+
id: runtimeModel
|
|
153
|
+
|
|
154
|
+
source: ""
|
|
155
|
+
position: Qt.vector3d(-modelViewRoot.modelCenter.x, -modelViewRoot.modelCenter.y, -modelViewRoot.modelCenter.z)
|
|
156
|
+
onBoundsChanged: modelViewRoot.updateBounds()
|
|
157
|
+
onStatusChanged: {
|
|
158
|
+
modelViewRoot.event("status", {
|
|
159
|
+
"value": status,
|
|
160
|
+
"error": errorString
|
|
161
|
+
});
|
|
162
|
+
if (status === RuntimeLoader.Success) {
|
|
163
|
+
modelViewRoot.ready = true;
|
|
164
|
+
modelViewRoot.updateBounds();
|
|
165
|
+
modelViewRoot.event("loaded", {
|
|
166
|
+
"source": source,
|
|
167
|
+
"width": bounds.maximum.x - bounds.minimum.x,
|
|
168
|
+
"height": bounds.maximum.y - bounds.minimum.y,
|
|
169
|
+
"depth": bounds.maximum.z - bounds.minimum.z
|
|
170
|
+
});
|
|
171
|
+
} else if (status === RuntimeLoader.Error) {
|
|
172
|
+
modelViewRoot.ready = false;
|
|
173
|
+
renderer.componentError("model_load_failed", errorString, {
|
|
174
|
+
"source": source,
|
|
175
|
+
"status": status
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
environment: SceneEnvironment {
|
|
184
|
+
backgroundMode: SceneEnvironment.Transparent
|
|
185
|
+
antialiasingMode: String(renderer.prop("antialiasing", "msaa")) === "none" ? SceneEnvironment.NoAA : SceneEnvironment.MSAA
|
|
186
|
+
antialiasingQuality: SceneEnvironment.VeryHigh
|
|
187
|
+
temporalAAEnabled: false
|
|
188
|
+
aoStrength: 45
|
|
189
|
+
aoDistance: 12
|
|
190
|
+
tonemapMode: SceneEnvironment.TonemapModeAces
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
DragHandler {
|
|
196
|
+
id: orbitDrag
|
|
197
|
+
|
|
198
|
+
property real startingPitch: 0
|
|
199
|
+
property real startingYaw: 0
|
|
200
|
+
|
|
201
|
+
enabled: renderer.prop("interactive", true) !== false
|
|
202
|
+
target: null
|
|
203
|
+
acceptedButtons: Qt.LeftButton
|
|
204
|
+
onActiveChanged: {
|
|
205
|
+
if (active) {
|
|
206
|
+
startingPitch = modelViewRoot.currentPitch;
|
|
207
|
+
startingYaw = modelViewRoot.currentYaw;
|
|
208
|
+
} else {
|
|
209
|
+
modelViewRoot.sendRotation();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
onTranslationChanged: {
|
|
213
|
+
if (!active)
|
|
214
|
+
return ;
|
|
215
|
+
|
|
216
|
+
modelViewRoot.currentYaw = startingYaw + translation.x * 0.48;
|
|
217
|
+
modelViewRoot.currentPitch = Math.max(-88, Math.min(88, startingPitch - translation.y * 0.42));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
PinchHandler {
|
|
222
|
+
id: zoomPinch
|
|
223
|
+
|
|
224
|
+
property real startingZoom: 1
|
|
225
|
+
|
|
226
|
+
enabled: renderer.prop("interactive", true) !== false
|
|
227
|
+
target: null
|
|
228
|
+
minimumScale: Number(renderer.prop("minimum_zoom", 0.65))
|
|
229
|
+
maximumScale: Number(renderer.prop("maximum_zoom", 3.2))
|
|
230
|
+
onActiveChanged: {
|
|
231
|
+
if (active)
|
|
232
|
+
startingZoom = modelViewRoot.currentZoom;
|
|
233
|
+
else
|
|
234
|
+
modelViewRoot.event("zoom_change", {
|
|
235
|
+
"value": modelViewRoot.currentZoom
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
onActiveScaleChanged: {
|
|
239
|
+
if (active)
|
|
240
|
+
modelViewRoot.setZoom(startingZoom * activeScale, false);
|
|
241
|
+
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
WheelHandler {
|
|
246
|
+
id: zoomWheel
|
|
247
|
+
|
|
248
|
+
enabled: renderer.prop("interactive", true) !== false
|
|
249
|
+
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
|
250
|
+
onWheel: function(event) {
|
|
251
|
+
modelViewRoot.setZoom(modelViewRoot.currentZoom * Math.exp(event.angleDelta.y / 900), true);
|
|
252
|
+
event.accepted = true;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
TapHandler {
|
|
257
|
+
acceptedButtons: Qt.LeftButton
|
|
258
|
+
gesturePolicy: TapHandler.DragThreshold
|
|
259
|
+
onTapped: function(eventPoint) {
|
|
260
|
+
modelViewRoot.event("click", {
|
|
261
|
+
"x": eventPoint.position.x,
|
|
262
|
+
"y": eventPoint.position.y
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
onDoubleTapped: function(eventPoint) {
|
|
266
|
+
modelViewRoot.setZoom(modelViewRoot.currentZoom + 0.55, true);
|
|
267
|
+
modelViewRoot.event("double_click", {
|
|
268
|
+
"x": eventPoint.position.x,
|
|
269
|
+
"y": eventPoint.position.y,
|
|
270
|
+
"zoom": modelViewRoot.currentZoom
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
Connections {
|
|
276
|
+
function onNodeChanged() {
|
|
277
|
+
modelViewRoot.synchronizeModelSource();
|
|
278
|
+
modelViewRoot.syncFromRenderer();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
target: renderer
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
NumberAnimation on automaticYaw {
|
|
285
|
+
from: 0
|
|
286
|
+
to: 360
|
|
287
|
+
duration: Math.max(1000, Math.round(360000 / Math.max(0.1, Number(renderer.prop("auto_rotate_speed", 4)))))
|
|
288
|
+
loops: Animation.Infinite
|
|
289
|
+
running: renderer.prop("auto_rotate", false) === true && !orbitDrag.active
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import "../../Theme"
|
|
5
|
+
|
|
6
|
+
QQC.SwipeDelegate {
|
|
7
|
+
id: swipeRoot
|
|
8
|
+
|
|
9
|
+
required property var renderer
|
|
10
|
+
readonly property bool selected: renderer.prop("selected", false) === true
|
|
11
|
+
readonly property bool hasLeftAction: String(renderer.prop("left_action", "")).length > 0
|
|
12
|
+
|| String(renderer.prop("left_icon", "")).length > 0
|
|
13
|
+
readonly property bool hasRightAction: String(renderer.prop("right_action", "")).length > 0
|
|
14
|
+
|| String(renderer.prop("right_icon", "")).length > 0
|
|
15
|
+
readonly property string requestedSide: String(renderer.prop("opened_side", "none"))
|
|
16
|
+
|
|
17
|
+
function eventPayload() {
|
|
18
|
+
return {
|
|
19
|
+
text: text,
|
|
20
|
+
value: renderer.prop("value", text),
|
|
21
|
+
selected: selected
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function actionPayload(side) {
|
|
26
|
+
var isLeft = side === "left"
|
|
27
|
+
return {
|
|
28
|
+
side: side,
|
|
29
|
+
action: String(renderer.prop(isLeft ? "left_action" : "right_action", "")),
|
|
30
|
+
value: renderer.prop(isLeft ? "left_value" : "right_value",
|
|
31
|
+
renderer.prop("value", text)),
|
|
32
|
+
item_value: renderer.prop("value", text)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function triggerAction(side) {
|
|
37
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
38
|
+
side === "left" ? "left_action" : "right_action", actionPayload(side))
|
|
39
|
+
if (renderer.prop("close_on_action", true) !== false) swipe.close()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function syncOpenedSide() {
|
|
43
|
+
if (!swipe.enabled) return
|
|
44
|
+
if (requestedSide === "left" && hasLeftAction) swipe.open(QQC.SwipeDelegate.Left)
|
|
45
|
+
else if (requestedSide === "right" && hasRightAction) swipe.open(QQC.SwipeDelegate.Right)
|
|
46
|
+
else if (requestedSide === "none" || requestedSide === "closed") swipe.close()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
text: String(renderer.prop("text", ""))
|
|
50
|
+
highlighted: renderer.prop("highlighted", selected) === true
|
|
51
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
52
|
+
visible: renderer.prop("visible", true) !== false
|
|
53
|
+
hoverEnabled: true
|
|
54
|
+
implicitWidth: Number(renderer.prop("width", 360))
|
|
55
|
+
implicitHeight: Number(renderer.prop("height", 60))
|
|
56
|
+
padding: Number(renderer.prop("padding", Style.spacing.md))
|
|
57
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
58
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
59
|
+
Accessible.name: String(renderer.prop("accessible_name", text))
|
|
60
|
+
|
|
61
|
+
swipe.enabled: renderer.prop("swipe_enabled", true) !== false
|
|
62
|
+
swipe.left: hasLeftAction ? leftActionComponent : null
|
|
63
|
+
swipe.right: hasRightAction ? rightActionComponent : null
|
|
64
|
+
swipe.transition: Transition {
|
|
65
|
+
NumberAnimation {
|
|
66
|
+
properties: "x"
|
|
67
|
+
duration: renderer.prop("animated", true) !== false
|
|
68
|
+
? Number(renderer.prop("duration", 180)) : 0
|
|
69
|
+
easing.type: Easing.InOutCubic
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
background: Rectangle {
|
|
74
|
+
color: swipeRoot.highlighted
|
|
75
|
+
? renderer.prop("highlighted_background", renderer.prop("selected_background", Color.popups.background))
|
|
76
|
+
: (swipeRoot.selected
|
|
77
|
+
? renderer.prop("selected_background", Color.popups.background)
|
|
78
|
+
: renderer.prop("background", Color.background))
|
|
79
|
+
radius: Number(renderer.prop("radius", Style.cornerRadius))
|
|
80
|
+
border.width: Number(renderer.prop("border_width",
|
|
81
|
+
String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0))
|
|
82
|
+
border.color: renderer.prop("border_color", "transparent")
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
contentItem: RowLayout {
|
|
86
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.md))
|
|
87
|
+
|
|
88
|
+
Image {
|
|
89
|
+
Layout.preferredWidth: Number(renderer.prop("icon_size", 22))
|
|
90
|
+
Layout.preferredHeight: Number(renderer.prop("icon_size", 22))
|
|
91
|
+
Layout.alignment: Qt.AlignVCenter
|
|
92
|
+
visible: source.toString().length > 0
|
|
93
|
+
source: String(renderer.prop("icon_source", ""))
|
|
94
|
+
fillMode: Image.PreserveAspectFit
|
|
95
|
+
onStatusChanged: {
|
|
96
|
+
if (status === Image.Error)
|
|
97
|
+
renderer.componentError("swipe_delegate_icon_failed",
|
|
98
|
+
"Unable to load the declared swipe delegate icon image", { source: String(source) })
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Text {
|
|
103
|
+
Layout.preferredWidth: Number(renderer.prop("icon_size", 22))
|
|
104
|
+
Layout.alignment: Qt.AlignVCenter
|
|
105
|
+
visible: text.length > 0 && String(renderer.prop("icon_source", "")).length === 0
|
|
106
|
+
text: String(renderer.prop("icon", "")).length > 0
|
|
107
|
+
? renderer.iconGlyph(renderer.prop("icon", "")) : ""
|
|
108
|
+
color: renderer.prop("icon_color", renderer.prop("foreground", renderer.foreground))
|
|
109
|
+
font.family: renderer.fontFamily
|
|
110
|
+
font.pixelSize: Number(renderer.prop("icon_size", 22))
|
|
111
|
+
horizontalAlignment: Text.AlignHCenter
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
ColumnLayout {
|
|
115
|
+
Layout.fillWidth: true
|
|
116
|
+
spacing: Style.spacing.xs
|
|
117
|
+
Text {
|
|
118
|
+
Layout.fillWidth: true
|
|
119
|
+
text: swipeRoot.text
|
|
120
|
+
color: swipeRoot.selected
|
|
121
|
+
? renderer.prop("selected_foreground", renderer.prop("foreground", renderer.foreground))
|
|
122
|
+
: renderer.prop("foreground", renderer.foreground)
|
|
123
|
+
font: swipeRoot.font
|
|
124
|
+
elide: Text.ElideRight
|
|
125
|
+
}
|
|
126
|
+
Text {
|
|
127
|
+
Layout.fillWidth: true
|
|
128
|
+
visible: text.length > 0
|
|
129
|
+
text: String(renderer.prop("description", ""))
|
|
130
|
+
color: renderer.prop("muted", Color.muted)
|
|
131
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
132
|
+
font.pixelSize: Number(renderer.prop("description_size", Style.font.caption))
|
|
133
|
+
elide: Text.ElideRight
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
Component {
|
|
139
|
+
id: leftActionComponent
|
|
140
|
+
Rectangle {
|
|
141
|
+
implicitWidth: Number(renderer.prop("action_width", 96))
|
|
142
|
+
color: renderer.prop("left_color", renderer.prop("accent", Color.accent))
|
|
143
|
+
Row {
|
|
144
|
+
anchors.centerIn: parent
|
|
145
|
+
spacing: Style.spacing.sm
|
|
146
|
+
Text {
|
|
147
|
+
visible: text.length > 0
|
|
148
|
+
text: renderer.iconGlyph(renderer.prop("left_icon", ""))
|
|
149
|
+
color: Color.background
|
|
150
|
+
font.family: renderer.fontFamily
|
|
151
|
+
font.pixelSize: Number(renderer.prop("icon_size", 22))
|
|
152
|
+
}
|
|
153
|
+
Text {
|
|
154
|
+
visible: text.length > 0
|
|
155
|
+
text: String(renderer.prop("left_action", ""))
|
|
156
|
+
color: Color.background
|
|
157
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
158
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
QQC.SwipeDelegate.onClicked: swipeRoot.triggerAction("left")
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
Component {
|
|
166
|
+
id: rightActionComponent
|
|
167
|
+
Rectangle {
|
|
168
|
+
implicitWidth: Number(renderer.prop("action_width", 96))
|
|
169
|
+
color: renderer.prop("right_color", Color.urgent)
|
|
170
|
+
Row {
|
|
171
|
+
anchors.centerIn: parent
|
|
172
|
+
spacing: Style.spacing.sm
|
|
173
|
+
Text {
|
|
174
|
+
visible: text.length > 0
|
|
175
|
+
text: renderer.iconGlyph(renderer.prop("right_icon", ""))
|
|
176
|
+
color: Color.background
|
|
177
|
+
font.family: renderer.fontFamily
|
|
178
|
+
font.pixelSize: Number(renderer.prop("icon_size", 22))
|
|
179
|
+
}
|
|
180
|
+
Text {
|
|
181
|
+
visible: text.length > 0
|
|
182
|
+
text: String(renderer.prop("right_action", ""))
|
|
183
|
+
color: Color.background
|
|
184
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
185
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
QQC.SwipeDelegate.onClicked: swipeRoot.triggerAction("right")
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
Connections {
|
|
193
|
+
target: swipeRoot.swipe
|
|
194
|
+
function onPositionChanged() {
|
|
195
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_position", {
|
|
196
|
+
value: swipeRoot.swipe.position,
|
|
197
|
+
side: swipeRoot.swipe.position > 0 ? "left" : (swipeRoot.swipe.position < 0 ? "right" : "none")
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
function onCompleted() {
|
|
201
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_complete", {
|
|
202
|
+
position: swipeRoot.swipe.position,
|
|
203
|
+
side: swipeRoot.swipe.position > 0 ? "left" : "right"
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
function onOpened() {
|
|
207
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_open", {
|
|
208
|
+
side: swipeRoot.swipe.position > 0 ? "left" : "right"
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
function onClosed() {
|
|
212
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "swipe_close", {})
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
Component.onCompleted: syncOpenedSide()
|
|
217
|
+
onRequestedSideChanged: syncOpenedSide()
|
|
218
|
+
onClicked: {
|
|
219
|
+
var payload = eventPayload()
|
|
220
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", payload)
|
|
221
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "activate", payload)
|
|
222
|
+
}
|
|
223
|
+
onPressed: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "press", eventPayload())
|
|
224
|
+
onReleased: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "release", eventPayload())
|
|
225
|
+
onHoveredChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
226
|
+
"hover", { value: hovered })
|
|
227
|
+
onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
228
|
+
activeFocus ? "focus" : "blur", {})
|
|
229
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
230
|
+
visible ? "show" : "hide", {})
|
|
231
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
QQC.SwipeView {
|
|
6
|
+
id: swipeRoot
|
|
7
|
+
|
|
8
|
+
required property var renderer
|
|
9
|
+
readonly property int requestedIndex: Number(renderer.prop("current_index", 0))
|
|
10
|
+
property bool synchronizing: false
|
|
11
|
+
property bool initialized: false
|
|
12
|
+
|
|
13
|
+
function boundedIndex(value) {
|
|
14
|
+
return count === 0 ? -1 : Math.max(0, Math.min(count - 1, Number(value)))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function syncSelection() {
|
|
18
|
+
var next = boundedIndex(requestedIndex)
|
|
19
|
+
if (currentIndex === next) return
|
|
20
|
+
synchronizing = true
|
|
21
|
+
currentIndex = next
|
|
22
|
+
synchronizing = false
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
implicitWidth: Number(renderer.prop("width", 640))
|
|
26
|
+
implicitHeight: Number(renderer.prop("height", 420))
|
|
27
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
28
|
+
visible: renderer.prop("visible", true) !== false
|
|
29
|
+
interactive: renderer.prop("interactive", true) !== false
|
|
30
|
+
orientation: String(renderer.prop("orientation", "horizontal")) === "vertical"
|
|
31
|
+
? Qt.Vertical : Qt.Horizontal
|
|
32
|
+
clip: renderer.prop("clip", true) !== false
|
|
33
|
+
LayoutMirroring.enabled: String(renderer.prop("layout_direction", "left_to_right")) === "right_to_left"
|
|
34
|
+
LayoutMirroring.childrenInherit: true
|
|
35
|
+
|
|
36
|
+
background: Rectangle {
|
|
37
|
+
color: renderer.prop("background", Color.background)
|
|
38
|
+
radius: Number(renderer.prop("radius", 0))
|
|
39
|
+
border.width: String(renderer.prop("border_color", "")).length > 0 ? Style.normalBorderWidth : 0
|
|
40
|
+
border.color: renderer.prop("border_color", "transparent")
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Repeater {
|
|
44
|
+
model: renderer.node.children || []
|
|
45
|
+
delegate: renderer.childDelegateComponent
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Component.onCompleted: {
|
|
49
|
+
initialized = true
|
|
50
|
+
syncSelection()
|
|
51
|
+
}
|
|
52
|
+
onRequestedIndexChanged: syncSelection()
|
|
53
|
+
onCountChanged: {
|
|
54
|
+
syncSelection()
|
|
55
|
+
if (initialized && renderer.subscribed("count_change"))
|
|
56
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "count_change", { value: count })
|
|
57
|
+
}
|
|
58
|
+
onCurrentIndexChanged: {
|
|
59
|
+
if (synchronizing || currentIndex < 0) return
|
|
60
|
+
if (renderer.subscribed("input"))
|
|
61
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "input", { value: currentIndex })
|
|
62
|
+
if (renderer.subscribed("change"))
|
|
63
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: currentIndex })
|
|
64
|
+
}
|
|
65
|
+
onVisibleChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
66
|
+
visible ? "show" : "hide", {})
|
|
67
|
+
onActiveFocusChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
68
|
+
activeFocus ? "focus" : "blur", {})
|
|
69
|
+
}
|