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,204 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
Rectangle {
|
|
6
|
+
id: reorderRoot
|
|
7
|
+
|
|
8
|
+
property var renderer: null
|
|
9
|
+
readonly property var items: renderer ? renderer.prop("items", []) : []
|
|
10
|
+
readonly property real outerPadding: Number(renderer ? renderer.prop("padding", 0) : 0)
|
|
11
|
+
|
|
12
|
+
implicitWidth: Number(renderer ? renderer.prop("width", 360) : 360)
|
|
13
|
+
implicitHeight: Number(renderer ? renderer.prop("height", 420) : 420)
|
|
14
|
+
color: renderer ? renderer.prop("background", "transparent") : "transparent"
|
|
15
|
+
radius: Number(renderer ? renderer.prop("radius", 0) : 0)
|
|
16
|
+
border.color: renderer ? renderer.prop("border_color", "transparent") : "transparent"
|
|
17
|
+
|
|
18
|
+
function field(item, name, fallback) {
|
|
19
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item)) {
|
|
20
|
+
var key = String(renderer.prop(name, fallback))
|
|
21
|
+
return item[key] === undefined ? null : item[key]
|
|
22
|
+
}
|
|
23
|
+
return item
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function payload(index, item) {
|
|
27
|
+
return { index: index, item: item, value: field(item, "key_field", "id") }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function send(name, payload) {
|
|
31
|
+
if (renderer.subscribed(name))
|
|
32
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, name, payload || {})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ListView {
|
|
36
|
+
id: listControl
|
|
37
|
+
|
|
38
|
+
anchors.fill: parent
|
|
39
|
+
anchors.margins: reorderRoot.outerPadding
|
|
40
|
+
model: reorderRoot.items
|
|
41
|
+
orientation: String(renderer.prop("orientation", "vertical")) === "horizontal"
|
|
42
|
+
? ListView.Horizontal : ListView.Vertical
|
|
43
|
+
spacing: Number(renderer.prop("spacing", 4))
|
|
44
|
+
clip: true
|
|
45
|
+
boundsBehavior: Flickable.StopAtBounds
|
|
46
|
+
displaced: Transition {
|
|
47
|
+
NumberAnimation {
|
|
48
|
+
properties: "x,y"
|
|
49
|
+
duration: Number(renderer.prop("drag_transition_duration", 180))
|
|
50
|
+
easing.type: Easing.OutCubic
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
delegate: QQC.ItemDelegate {
|
|
55
|
+
id: rowDelegate
|
|
56
|
+
|
|
57
|
+
required property int index
|
|
58
|
+
required property var modelData
|
|
59
|
+
property real dragOffsetX: dragHandler.active ? dragHandler.translation.x : 0
|
|
60
|
+
property real dragOffsetY: dragHandler.active ? dragHandler.translation.y : 0
|
|
61
|
+
|
|
62
|
+
width: listControl.orientation === ListView.Vertical
|
|
63
|
+
? listControl.width : Number(renderer.prop("item_height", 58)) * 3.2
|
|
64
|
+
height: listControl.orientation === ListView.Horizontal
|
|
65
|
+
? listControl.height : Number(renderer.prop("item_height", 58))
|
|
66
|
+
highlighted: renderer.prop("selected", null) === reorderRoot.field(modelData, "key_field", "id")
|
|
67
|
+
z: dragHandler.active ? 20 : 0
|
|
68
|
+
scale: dragHandler.active ? Number(renderer.prop("drag_scale", 1.025)) : 1
|
|
69
|
+
opacity: dragHandler.active ? Number(renderer.prop("drag_opacity", 0.94)) : 1
|
|
70
|
+
leftPadding: Number(renderer.prop("item_padding", 12))
|
|
71
|
+
rightPadding: Number(renderer.prop("item_padding", 12))
|
|
72
|
+
topPadding: 7
|
|
73
|
+
bottomPadding: 7
|
|
74
|
+
transform: Translate { x: rowDelegate.dragOffsetX; y: rowDelegate.dragOffsetY }
|
|
75
|
+
|
|
76
|
+
Behavior on dragOffsetX {
|
|
77
|
+
NumberAnimation {
|
|
78
|
+
duration: Number(renderer.prop("drag_transition_duration", 180))
|
|
79
|
+
easing.type: Easing.OutCubic
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
Behavior on dragOffsetY {
|
|
83
|
+
NumberAnimation {
|
|
84
|
+
duration: Number(renderer.prop("drag_transition_duration", 180))
|
|
85
|
+
easing.type: Easing.OutCubic
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
Behavior on scale { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
89
|
+
Behavior on opacity { NumberAnimation { duration: 130 } }
|
|
90
|
+
|
|
91
|
+
background: Rectangle {
|
|
92
|
+
color: rowDelegate.highlighted
|
|
93
|
+
? renderer.prop("selected_background", Color.popups.background)
|
|
94
|
+
: renderer.prop("item_background", "transparent")
|
|
95
|
+
radius: Number(renderer.prop("radius", 0))
|
|
96
|
+
border.width: dragHandler.active ? 1 : 0
|
|
97
|
+
border.color: renderer.prop("selected_foreground", renderer.foreground)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
contentItem: Item {
|
|
101
|
+
Text {
|
|
102
|
+
id: handle
|
|
103
|
+
anchors.right: parent.right
|
|
104
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
105
|
+
visible: renderer.prop("drag_enabled", true) !== false
|
|
106
|
+
text: "⋮⋮"
|
|
107
|
+
color: dragHandler.active
|
|
108
|
+
? renderer.prop("selected_foreground", renderer.foreground)
|
|
109
|
+
: renderer.prop("muted", Color.muted)
|
|
110
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body)) + 2
|
|
111
|
+
verticalAlignment: Text.AlignVCenter
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
Column {
|
|
115
|
+
anchors.left: parent.left
|
|
116
|
+
anchors.right: handle.left
|
|
117
|
+
anchors.rightMargin: 14
|
|
118
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
119
|
+
spacing: 2
|
|
120
|
+
|
|
121
|
+
Text {
|
|
122
|
+
width: parent.width
|
|
123
|
+
text: String(reorderRoot.field(rowDelegate.modelData, "label_field", "label") || "")
|
|
124
|
+
color: rowDelegate.highlighted
|
|
125
|
+
? renderer.prop("selected_foreground", renderer.foreground)
|
|
126
|
+
: renderer.prop("foreground", renderer.foreground)
|
|
127
|
+
font.family: renderer.prop("font_family", renderer.fontFamily)
|
|
128
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
129
|
+
font.weight: Font.DemiBold
|
|
130
|
+
elide: Text.ElideRight
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
Text {
|
|
134
|
+
width: parent.width
|
|
135
|
+
text: String(reorderRoot.field(rowDelegate.modelData, "description_field", "description") || "")
|
|
136
|
+
color: renderer.prop("muted", Color.muted)
|
|
137
|
+
font.family: renderer.prop("font_family", renderer.fontFamily)
|
|
138
|
+
font.pixelSize: Math.max(9, Number(renderer.prop("font_size", Style.font.body)) - 2)
|
|
139
|
+
elide: Text.ElideRight
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onClicked: {
|
|
145
|
+
var eventPayload = reorderRoot.payload(index, modelData)
|
|
146
|
+
reorderRoot.send("activate", eventPayload)
|
|
147
|
+
reorderRoot.send("change", eventPayload)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
DragHandler {
|
|
151
|
+
id: dragHandler
|
|
152
|
+
|
|
153
|
+
enabled: renderer.prop("drag_enabled", true) !== false
|
|
154
|
+
target: null
|
|
155
|
+
xAxis.enabled: listControl.orientation === ListView.Horizontal
|
|
156
|
+
yAxis.enabled: listControl.orientation === ListView.Vertical
|
|
157
|
+
|
|
158
|
+
onTranslationChanged: {
|
|
159
|
+
if (!active) return
|
|
160
|
+
var point = rowDelegate.mapToItem(listControl.contentItem,
|
|
161
|
+
rowDelegate.width / 2 + translation.x,
|
|
162
|
+
rowDelegate.height / 2 + translation.y)
|
|
163
|
+
var targetIndex = listControl.indexAt(point.x, point.y)
|
|
164
|
+
reorderRoot.send("drag_move", {
|
|
165
|
+
from: rowDelegate.index,
|
|
166
|
+
to: targetIndex,
|
|
167
|
+
x: point.x,
|
|
168
|
+
y: point.y,
|
|
169
|
+
item: rowDelegate.modelData
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
onActiveChanged: {
|
|
174
|
+
if (active) {
|
|
175
|
+
reorderRoot.send("drag_start", reorderRoot.payload(rowDelegate.index, rowDelegate.modelData))
|
|
176
|
+
return
|
|
177
|
+
}
|
|
178
|
+
var point = rowDelegate.mapToItem(listControl.contentItem,
|
|
179
|
+
rowDelegate.width / 2 + translation.x,
|
|
180
|
+
rowDelegate.height / 2 + translation.y)
|
|
181
|
+
var targetIndex = listControl.indexAt(point.x, point.y)
|
|
182
|
+
if (targetIndex < 0) targetIndex = Math.max(0, reorderRoot.items.length - 1)
|
|
183
|
+
reorderRoot.send("reorder", {
|
|
184
|
+
from: rowDelegate.index,
|
|
185
|
+
to: targetIndex,
|
|
186
|
+
item: rowDelegate.modelData
|
|
187
|
+
})
|
|
188
|
+
reorderRoot.send("drag_end", {
|
|
189
|
+
from: rowDelegate.index,
|
|
190
|
+
to: targetIndex,
|
|
191
|
+
item: rowDelegate.modelData
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
Text {
|
|
198
|
+
anchors.centerIn: parent
|
|
199
|
+
visible: reorderRoot.items.length === 0
|
|
200
|
+
text: renderer.prop("empty_text", "No items")
|
|
201
|
+
color: renderer.prop("muted", Color.muted)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
Text {
|
|
10
|
+
required property var renderer
|
|
11
|
+
text: String(renderer.prop("text", ""))
|
|
12
|
+
textFormat: Text.RichText
|
|
13
|
+
color: renderer.prop("color", renderer.foreground)
|
|
14
|
+
linkColor: renderer.prop("link_color", Color.accent)
|
|
15
|
+
font.family: renderer.fontFamily
|
|
16
|
+
font.pixelSize: Number(renderer.prop("size", Style.font.body))
|
|
17
|
+
font.bold: renderer.prop("bold", false) === true
|
|
18
|
+
width: Number(renderer.prop("width", implicitWidth))
|
|
19
|
+
wrapMode: renderer.prop("wrap", true) !== false ? Text.Wrap : Text.NoWrap
|
|
20
|
+
maximumLineCount: Number(renderer.prop("maximum_lines", 2147483647))
|
|
21
|
+
onLinkActivated: function(link) { renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "link", { value: link }) }
|
|
22
|
+
HoverHandler { cursorShape: parent.hoveredLink.length > 0 ? Qt.PointingHandCursor : Qt.ArrowCursor }
|
|
23
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
QQC.RoundButton {
|
|
10
|
+
required property var renderer
|
|
11
|
+
id: nativeRoundButton
|
|
12
|
+
text: String(renderer.prop("text", ""))
|
|
13
|
+
checkable: renderer.prop("checkable", false) === true
|
|
14
|
+
checked: renderer.prop("checked", false) === true
|
|
15
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
16
|
+
implicitWidth: Number(renderer.prop("diameter", 44))
|
|
17
|
+
implicitHeight: implicitWidth
|
|
18
|
+
background: Rectangle {
|
|
19
|
+
radius: width / 2
|
|
20
|
+
color: nativeRoundButton.checked
|
|
21
|
+
? renderer.prop("checked_background", renderer.prop("accent", Color.accent))
|
|
22
|
+
: renderer.prop("background", Color.popups.background)
|
|
23
|
+
border.width: Style.normalBorderWidth
|
|
24
|
+
border.color: nativeRoundButton.activeFocus ? renderer.prop("accent", Color.accent) : renderer.prop("foreground", renderer.foreground)
|
|
25
|
+
opacity: nativeRoundButton.down ? 0.75 : (nativeRoundButton.hovered ? 0.9 : 1)
|
|
26
|
+
}
|
|
27
|
+
contentItem: Text {
|
|
28
|
+
text: String(renderer.prop("icon", "")).length > 0 ? renderer.iconGlyph(renderer.prop("icon", "")) : nativeRoundButton.text
|
|
29
|
+
textFormat: Text.PlainText
|
|
30
|
+
color: nativeRoundButton.checked ? Color.background : renderer.prop("foreground", renderer.foreground)
|
|
31
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
32
|
+
font.pixelSize: Number(String(renderer.prop("icon", "")).length > 0 ? renderer.prop("icon_size", Style.font.icon) : renderer.prop("font_size", Style.font.body))
|
|
33
|
+
font.bold: true
|
|
34
|
+
horizontalAlignment: Text.AlignHCenter
|
|
35
|
+
verticalAlignment: Text.AlignVCenter
|
|
36
|
+
}
|
|
37
|
+
onClicked: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "click", { checked: checked })
|
|
38
|
+
onToggled: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: checked })
|
|
39
|
+
onPressed: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "press", {})
|
|
40
|
+
onReleased: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "release", {})
|
|
41
|
+
onHoveredChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "hover", { value: hovered })
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
Row {
|
|
10
|
+
required property var renderer
|
|
11
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.controlGap))
|
|
12
|
+
|
|
13
|
+
Repeater {
|
|
14
|
+
model: renderer.node && Array.isArray(renderer.node.children) ? renderer.node.children : []
|
|
15
|
+
delegate: renderer.rowChildDelegateComponent
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
RowLayout {
|
|
10
|
+
required property var renderer
|
|
11
|
+
spacing: Number(renderer.prop("spacing", Style.spacing.controlGap))
|
|
12
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.layoutChildDelegateComponent }
|
|
13
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import QtMultimedia
|
|
2
|
+
import QtQuick
|
|
3
|
+
|
|
4
|
+
Item {
|
|
5
|
+
id: screenRoot
|
|
6
|
+
|
|
7
|
+
property var renderer: null
|
|
8
|
+
property alias screenCapture: nativeCapture
|
|
9
|
+
property int handledCommandRevision: -1
|
|
10
|
+
|
|
11
|
+
function selectedScreen() {
|
|
12
|
+
var screens = Application.screens || [];
|
|
13
|
+
var requested = renderer ? renderer.prop("screen", 0) : 0;
|
|
14
|
+
if (typeof requested === "number") {
|
|
15
|
+
if (requested >= 0 && requested < screens.length)
|
|
16
|
+
return screens[requested];
|
|
17
|
+
if (renderer)
|
|
18
|
+
renderer.componentError("screen_not_found", "The declared screen does not exist", {
|
|
19
|
+
"screen": String(requested)
|
|
20
|
+
});
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (var index = 0; index < screens.length; index++) if (screens[index].name === String(requested)) {
|
|
25
|
+
return screens[index];
|
|
26
|
+
}
|
|
27
|
+
if (renderer)
|
|
28
|
+
renderer.componentError("screen_not_found", "The declared screen does not exist", {
|
|
29
|
+
"screen": String(requested)
|
|
30
|
+
});
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function command() {
|
|
35
|
+
if (!renderer)
|
|
36
|
+
return ;
|
|
37
|
+
|
|
38
|
+
var revision = Number(renderer.prop("command_revision", 0));
|
|
39
|
+
if (revision === handledCommandRevision)
|
|
40
|
+
return ;
|
|
41
|
+
|
|
42
|
+
handledCommandRevision = revision;
|
|
43
|
+
var value = String(renderer.prop("command", ""));
|
|
44
|
+
if (value === "start")
|
|
45
|
+
nativeCapture.start();
|
|
46
|
+
else if (value === "stop")
|
|
47
|
+
nativeCapture.stop();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
Component.onCompleted: command()
|
|
51
|
+
|
|
52
|
+
ScreenCapture {
|
|
53
|
+
id: nativeCapture
|
|
54
|
+
|
|
55
|
+
screen: screenRoot.selectedScreen()
|
|
56
|
+
active: renderer && renderer.prop("active", false) === true && screenRoot.selectedScreen() !== null
|
|
57
|
+
onActiveChanged: {
|
|
58
|
+
if (renderer) {
|
|
59
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, active ? "start" : "stop", {
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
onErrorOccurred: function(error, errorString) {
|
|
64
|
+
renderer.componentError("screen_capture_failed", errorString, {
|
|
65
|
+
"native_code": error
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
Connections {
|
|
71
|
+
function onNodeChanged() {
|
|
72
|
+
screenRoot.command();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
target: renderer
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
|
|
3
|
+
Item {
|
|
4
|
+
id: actionRoot
|
|
5
|
+
property var renderer: null
|
|
6
|
+
property int handledRevision: -1
|
|
7
|
+
function run() {
|
|
8
|
+
if (!renderer) return
|
|
9
|
+
var revision = Number(renderer.prop("revision", 0)); if (revision === handledRevision || renderer.prop("trigger", true) === false) return
|
|
10
|
+
handledRevision = revision; nativeAction.start()
|
|
11
|
+
}
|
|
12
|
+
ScriptAction { id: nativeAction; script: function() { renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "trigger", { action: renderer.prop("action", null), revision: actionRoot.handledRevision }); renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "finish", {}) } }
|
|
13
|
+
Component.onCompleted: run()
|
|
14
|
+
Connections { target: renderer; function onNodeChanged() { actionRoot.run() } }
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import QtQuick.Layouts
|
|
4
|
+
import QtMultimedia
|
|
5
|
+
import QtQuick.VectorImage
|
|
6
|
+
import "../../Theme"
|
|
7
|
+
import "../../Controls" as ZuiControls
|
|
8
|
+
|
|
9
|
+
QQC.ScrollView {
|
|
10
|
+
required property var renderer
|
|
11
|
+
implicitWidth: Number(renderer.prop("width", 320))
|
|
12
|
+
implicitHeight: Number(renderer.prop("height", 240))
|
|
13
|
+
clip: renderer.prop("clip", true) !== false
|
|
14
|
+
Column {
|
|
15
|
+
spacing: Style.spacing.panelGap
|
|
16
|
+
Repeater { model: renderer.node.children || []; delegate: renderer.childDelegateComponent }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
|
|
4
|
+
QQC.ScrollBar {
|
|
5
|
+
id: barRoot
|
|
6
|
+
property var renderer: null
|
|
7
|
+
readonly property var scrollTarget: renderer ? renderer.findRenderedItem(renderer.prop("target", "")) : null
|
|
8
|
+
orientation: String(renderer ? renderer.prop("orientation", "vertical") : "vertical") === "horizontal" ? Qt.Horizontal : Qt.Vertical
|
|
9
|
+
policy: { var value=String(renderer ? renderer.prop("policy", "as_needed") : "as_needed"); if(value==="always")return QQC.ScrollBar.AlwaysOn;if(value==="never")return QQC.ScrollBar.AlwaysOff;return QQC.ScrollBar.AsNeeded }
|
|
10
|
+
position: scrollTarget && scrollTarget.visibleArea ? (orientation === Qt.Vertical ? scrollTarget.visibleArea.yPosition : scrollTarget.visibleArea.xPosition) : Number(renderer ? renderer.prop("position", 0) : 0)
|
|
11
|
+
size: scrollTarget && scrollTarget.visibleArea ? (orientation === Qt.Vertical ? scrollTarget.visibleArea.heightRatio : scrollTarget.visibleArea.widthRatio) : Number(renderer ? renderer.prop("size", 0.2) : 0.2)
|
|
12
|
+
active: renderer && renderer.prop("active", false) === true
|
|
13
|
+
interactive: !renderer || renderer.prop("interactive", true) !== false
|
|
14
|
+
stepSize: Number(renderer ? renderer.prop("step_size", 0.1) : 0.1); minimumSize: Number(renderer ? renderer.prop("minimum_size", 0) : 0)
|
|
15
|
+
implicitWidth: Number(renderer ? renderer.prop("width", orientation === Qt.Vertical ? 12 : 160) : 12); implicitHeight: Number(renderer ? renderer.prop("height", orientation === Qt.Vertical ? 160 : 12) : 160)
|
|
16
|
+
onPositionChanged: { if (pressed && scrollTarget) { if (orientation === Qt.Vertical) scrollTarget.contentY = position * Math.max(0, scrollTarget.contentHeight); else scrollTarget.contentX = position * Math.max(0, scrollTarget.contentWidth) } renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, pressed ? "input" : "change", { value: position, size: size }) }
|
|
17
|
+
onActiveChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "active_change", { value: active })
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
|
|
4
|
+
QQC.ScrollIndicator {
|
|
5
|
+
id: indicatorRoot
|
|
6
|
+
property var renderer: null
|
|
7
|
+
readonly property var scrollTarget: renderer ? renderer.findRenderedItem(renderer.prop("target", "")) : null
|
|
8
|
+
orientation: String(renderer ? renderer.prop("orientation", "vertical") : "vertical") === "horizontal" ? Qt.Horizontal : Qt.Vertical
|
|
9
|
+
position: scrollTarget && scrollTarget.visibleArea ? (orientation === Qt.Vertical ? scrollTarget.visibleArea.yPosition : scrollTarget.visibleArea.xPosition) : Number(renderer ? renderer.prop("position", 0) : 0)
|
|
10
|
+
size: scrollTarget && scrollTarget.visibleArea ? (orientation === Qt.Vertical ? scrollTarget.visibleArea.heightRatio : scrollTarget.visibleArea.widthRatio) : Number(renderer ? renderer.prop("size", 0.2) : 0.2)
|
|
11
|
+
active: renderer && renderer.prop("active", false) === true
|
|
12
|
+
minimumSize: Number(renderer ? renderer.prop("minimum_size", 0) : 0)
|
|
13
|
+
implicitWidth: Number(renderer ? renderer.prop("width", orientation === Qt.Vertical ? 6 : 160) : 6); implicitHeight: Number(renderer ? renderer.prop("height", orientation === Qt.Vertical ? 160 : 6) : 160)
|
|
14
|
+
onActiveChanged: renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "active_change", { value: active })
|
|
15
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import QtQuick
|
|
2
|
+
import QtQuick.Controls as QQC
|
|
3
|
+
import "../../Theme"
|
|
4
|
+
|
|
5
|
+
QQC.TextField {
|
|
6
|
+
id: nativeSearchField
|
|
7
|
+
required property var renderer
|
|
8
|
+
|
|
9
|
+
readonly property var suggestionModel: renderer.prop("suggestions", [])
|
|
10
|
+
readonly property string textRole: String(renderer.prop("text_role", ""))
|
|
11
|
+
readonly property bool live: renderer.prop("live", false) === true
|
|
12
|
+
property int highlightedIndex: Number(renderer.prop("current_index", -1))
|
|
13
|
+
|
|
14
|
+
function suggestionText(entry) {
|
|
15
|
+
if (entry !== null && typeof entry === "object") {
|
|
16
|
+
if (textRole.length > 0 && entry[textRole] !== undefined) return String(entry[textRole])
|
|
17
|
+
if (entry.label !== undefined) return String(entry.label)
|
|
18
|
+
if (entry.text !== undefined) return String(entry.text)
|
|
19
|
+
if (entry.value !== undefined) return String(entry.value)
|
|
20
|
+
}
|
|
21
|
+
return String(entry === null || entry === undefined ? "" : entry)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function sendSearch() {
|
|
25
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "search", { value: text })
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function highlightSuggestion(index) {
|
|
29
|
+
if (!Array.isArray(suggestionModel) || suggestionModel.length === 0) return
|
|
30
|
+
highlightedIndex = Math.max(0, Math.min(suggestionModel.length - 1, index))
|
|
31
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "highlight",
|
|
32
|
+
{ index: highlightedIndex, value: suggestionText(suggestionModel[highlightedIndex]) })
|
|
33
|
+
suggestionList.positionViewAtIndex(highlightedIndex, ListView.Contain)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function activateSuggestion(index) {
|
|
37
|
+
if (!Array.isArray(suggestionModel) || index < 0 || index >= suggestionModel.length) return
|
|
38
|
+
highlightedIndex = index
|
|
39
|
+
text = suggestionText(suggestionModel[index])
|
|
40
|
+
suggestionPopup.close()
|
|
41
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "activate",
|
|
42
|
+
{ index: index, value: text })
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function synchronizePopup() {
|
|
46
|
+
if (activeFocus && Array.isArray(suggestionModel) && suggestionModel.length > 0)
|
|
47
|
+
suggestionPopup.open()
|
|
48
|
+
else
|
|
49
|
+
suggestionPopup.close()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
text: String(renderer.prop("text", ""))
|
|
53
|
+
enabled: renderer.prop("enabled", true) !== false
|
|
54
|
+
implicitWidth: Number(renderer.prop("width", 260))
|
|
55
|
+
leftPadding: 38
|
|
56
|
+
rightPadding: text.length > 0 ? 38 : 12
|
|
57
|
+
font.family: String(renderer.prop("font_family", renderer.fontFamily))
|
|
58
|
+
font.pixelSize: Number(renderer.prop("font_size", Style.font.body))
|
|
59
|
+
color: renderer.prop("foreground", renderer.foreground)
|
|
60
|
+
selectionColor: renderer.prop("accent", Color.accent)
|
|
61
|
+
selectedTextColor: Color.background
|
|
62
|
+
background: Rectangle {
|
|
63
|
+
color: renderer.prop("background", Color.popups.background)
|
|
64
|
+
radius: Style.cornerRadius
|
|
65
|
+
border.width: Style.normalBorderWidth
|
|
66
|
+
border.color: nativeSearchField.activeFocus
|
|
67
|
+
? renderer.prop("accent", Color.accent)
|
|
68
|
+
: renderer.prop("foreground", renderer.foreground)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
onTextEdited: {
|
|
72
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "input", { value: text })
|
|
73
|
+
if (live) sendSearch()
|
|
74
|
+
synchronizePopup()
|
|
75
|
+
}
|
|
76
|
+
onAccepted: {
|
|
77
|
+
if (suggestionPopup.opened && highlightedIndex >= 0)
|
|
78
|
+
activateSuggestion(highlightedIndex)
|
|
79
|
+
else
|
|
80
|
+
suggestionPopup.close()
|
|
81
|
+
sendSearch()
|
|
82
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "submit", { value: text })
|
|
83
|
+
}
|
|
84
|
+
onActiveFocusChanged: {
|
|
85
|
+
synchronizePopup()
|
|
86
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId,
|
|
87
|
+
activeFocus ? "focus" : "blur", { value: text })
|
|
88
|
+
if (!activeFocus && renderer.subscribed("change"))
|
|
89
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "change", { value: text })
|
|
90
|
+
}
|
|
91
|
+
onSuggestionModelChanged: synchronizePopup()
|
|
92
|
+
|
|
93
|
+
Keys.onDownPressed: function(event) {
|
|
94
|
+
highlightSuggestion(highlightedIndex < 0 ? 0 : highlightedIndex + 1)
|
|
95
|
+
suggestionPopup.open()
|
|
96
|
+
event.accepted = true
|
|
97
|
+
}
|
|
98
|
+
Keys.onUpPressed: function(event) {
|
|
99
|
+
highlightSuggestion(highlightedIndex < 0 ? suggestionModel.length - 1 : highlightedIndex - 1)
|
|
100
|
+
suggestionPopup.open()
|
|
101
|
+
event.accepted = true
|
|
102
|
+
}
|
|
103
|
+
Keys.onEscapePressed: function(event) {
|
|
104
|
+
suggestionPopup.close()
|
|
105
|
+
event.accepted = true
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
QQC.ToolButton {
|
|
109
|
+
id: searchButton
|
|
110
|
+
anchors.left: parent.left
|
|
111
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
112
|
+
width: 34
|
|
113
|
+
height: parent.height
|
|
114
|
+
text: "⌕"
|
|
115
|
+
focusPolicy: Qt.NoFocus
|
|
116
|
+
palette.buttonText: renderer.prop("foreground", renderer.foreground)
|
|
117
|
+
onClicked: nativeSearchField.sendSearch()
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
QQC.ToolButton {
|
|
121
|
+
anchors.right: parent.right
|
|
122
|
+
anchors.verticalCenter: parent.verticalCenter
|
|
123
|
+
width: 34
|
|
124
|
+
height: parent.height
|
|
125
|
+
visible: nativeSearchField.text.length > 0
|
|
126
|
+
text: "×"
|
|
127
|
+
focusPolicy: Qt.NoFocus
|
|
128
|
+
palette.buttonText: renderer.prop("foreground", renderer.foreground)
|
|
129
|
+
onClicked: {
|
|
130
|
+
nativeSearchField.text = ""
|
|
131
|
+
nativeSearchField.forceActiveFocus()
|
|
132
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "clear", {})
|
|
133
|
+
renderer.bridge.sendEvent(renderer.surfaceName, renderer.controlId, "input", { value: "" })
|
|
134
|
+
if (nativeSearchField.live) nativeSearchField.sendSearch()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
QQC.Popup {
|
|
139
|
+
id: suggestionPopup
|
|
140
|
+
parent: nativeSearchField
|
|
141
|
+
x: 0
|
|
142
|
+
y: nativeSearchField.height + 4
|
|
143
|
+
width: nativeSearchField.width
|
|
144
|
+
height: Math.min(contentItem.implicitHeight + topPadding + bottomPadding, 280)
|
|
145
|
+
padding: 4
|
|
146
|
+
closePolicy: QQC.Popup.CloseOnEscape | QQC.Popup.CloseOnPressOutsideParent
|
|
147
|
+
background: Rectangle {
|
|
148
|
+
color: renderer.prop("background", Color.popups.background)
|
|
149
|
+
radius: Style.cornerRadius
|
|
150
|
+
border.width: Style.normalBorderWidth
|
|
151
|
+
border.color: renderer.prop("accent", Color.accent)
|
|
152
|
+
}
|
|
153
|
+
contentItem: ListView {
|
|
154
|
+
id: suggestionList
|
|
155
|
+
implicitHeight: contentHeight
|
|
156
|
+
clip: true
|
|
157
|
+
model: Array.isArray(nativeSearchField.suggestionModel) ? nativeSearchField.suggestionModel : []
|
|
158
|
+
currentIndex: nativeSearchField.highlightedIndex
|
|
159
|
+
delegate: QQC.ItemDelegate {
|
|
160
|
+
required property int index
|
|
161
|
+
required property var modelData
|
|
162
|
+
width: suggestionList.width
|
|
163
|
+
text: nativeSearchField.suggestionText(modelData)
|
|
164
|
+
highlighted: index === nativeSearchField.highlightedIndex
|
|
165
|
+
font.family: nativeSearchField.font.family
|
|
166
|
+
font.pixelSize: nativeSearchField.font.pixelSize
|
|
167
|
+
palette.text: renderer.prop("foreground", renderer.foreground)
|
|
168
|
+
palette.highlightedText: Color.background
|
|
169
|
+
palette.highlight: renderer.prop("accent", Color.accent)
|
|
170
|
+
onHoveredChanged: {
|
|
171
|
+
if (hovered && index !== nativeSearchField.highlightedIndex)
|
|
172
|
+
nativeSearchField.highlightSuggestion(index)
|
|
173
|
+
}
|
|
174
|
+
onClicked: nativeSearchField.activateSuggestion(index)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|