From e4518ba234277418e66cc562a22859082bc750f9 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 4 Mar 2019 23:44:14 -0800 Subject: [PATCH] Fixing the bins and exploring the REpeater --- .../developer/utilities/lib/prop/Global.qml | 44 ---------- .../developer/utilities/lib/prop/PropBool.qml | 1 - .../developer/utilities/lib/prop/PropEnum.qml | 83 ++----------------- .../utilities/lib/prop/PropGroup.qml | 42 ++++++---- .../developer/utilities/lib/prop/PropItem.qml | 3 +- .../utilities/lib/prop/PropLabel.qml | 25 ------ .../utilities/lib/prop/PropSplitter.qml | 21 ----- .../developer/utilities/lib/prop/PropText.qml | 24 ------ scripts/developer/utilities/lib/prop/qmldir | 11 ++- .../utilities/lib/prop/style/Global.qml | 2 + .../utilities/lib/prop/style/PiComboBox.qml | 2 +- scripts/developer/utilities/render/luci.qml | 17 ++++ 12 files changed, 58 insertions(+), 217 deletions(-) delete mode 100644 scripts/developer/utilities/lib/prop/Global.qml delete mode 100644 scripts/developer/utilities/lib/prop/PropLabel.qml delete mode 100644 scripts/developer/utilities/lib/prop/PropSplitter.qml delete mode 100644 scripts/developer/utilities/lib/prop/PropText.qml diff --git a/scripts/developer/utilities/lib/prop/Global.qml b/scripts/developer/utilities/lib/prop/Global.qml deleted file mode 100644 index be189e3c96..0000000000 --- a/scripts/developer/utilities/lib/prop/Global.qml +++ /dev/null @@ -1,44 +0,0 @@ -// -// Prop/Global.qml -// -// Created by Sam Gateau on 3/2/2019 -// Copyright 2019 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html -// - -import QtQuick 2.7 - -import stylesUit 1.0 -import controlsUit 1.0 as HifiControls - - -Item { - HifiConstants { id: hifi } - id: root - - property real lineHeight: 32 - property real slimHeight: 24 - - property var color: hifi.colors.baseGray - property var colorBackHighlight: hifi.colors.baseGrayHighlight - property var colorBorderLight: hifi.colors.lightGray - property var colorBorderHighight: hifi.colors.blueHighlight - - property real fontSize: 12 - property var fontFamily: "Raleway" - property var fontWeight: Font.DemiBold - property var fontColor: hifi.colors.faintGray - - property var splitterRightWidthScale: 0.44 - property real splitterWidth: 4 - - property var labelTextAlign: Text.AlignRight - property var labelTextElide: Text.ElideMiddle - - property var valueAreaWidthScale: 0.3 * (1.0 - splitterRightWidthScale) - property var valueTextAlign: Text.AlignHCenter - property real valueBorderWidth: 1 - property real valueBorderRadius: 2 -} \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/PropBool.qml b/scripts/developer/utilities/lib/prop/PropBool.qml index e355398375..d8e4bad589 100644 --- a/scripts/developer/utilities/lib/prop/PropBool.qml +++ b/scripts/developer/utilities/lib/prop/PropBool.qml @@ -29,7 +29,6 @@ PropItem { width: root.width * global.valueAreaWidthScale height: global.slimHeight - checked: root.valueVar onCheckedChanged: { root.valueVarSetter(checked); } } } \ No newline at end of file diff --git a/scripts/developer/utilities/lib/prop/PropEnum.qml b/scripts/developer/utilities/lib/prop/PropEnum.qml index fe6200d971..9446a267b3 100644 --- a/scripts/developer/utilities/lib/prop/PropEnum.qml +++ b/scripts/developer/utilities/lib/prop/PropEnum.qml @@ -18,7 +18,11 @@ PropItem { property alias valueVar : valueCombo.currentIndex property alias enums : valueCombo.model - ComboBox { + Component.onCompleted: { + valueVar = root.valueVarGetter(); + } + + PropComboBox { id: valueCombo flat: true @@ -28,83 +32,6 @@ PropItem { anchors.verticalCenter: root.verticalCenter height: global.slimHeight - currentIndex: root.valueVarGetter() onCurrentIndexChanged: { root.valueVarSetter(currentIndex); } - - delegate: ItemDelegate { - width: valueCombo.width - height: valueCombo.height - contentItem: PropText { - text: modelData - horizontalAlignment: global.valueTextAlign - } - background: Rectangle { - color:highlighted?global.colorBackHighlight:global.color; - } - highlighted: valueCombo.highlightedIndex === index - } - - indicator: Canvas { - id: canvas - x: valueCombo.width - width - valueCombo.rightPadding - y: valueCombo.topPadding + (valueCombo.availableHeight - height) / 2 - width: 12 - height: 8 - contextType: "2d" - - Connections { - target: valueCombo - onPressedChanged: canvas.requestPaint() - } - - onPaint: { - context.reset(); - context.moveTo(0, 0); - context.lineTo(width, 0); - context.lineTo(width / 2, height); - context.closePath(); - context.fillStyle = (valueCombo.pressed) ? global.colorBorderHighight : global.colorBorderLight; - context.fill(); - } - } - - contentItem: PropText { - leftPadding: 0 - rightPadding: valueCombo.indicator.width + valueCombo.spacing - - text: valueCombo.displayText - horizontalAlignment: global.valueTextAlign - } - - background: Rectangle { - implicitWidth: 120 - implicitHeight: 40 - color: global.color - border.color: valueCombo.popup.visible ? global.colorBorderHighight : global.colorBorderLight - border.width: global.valueBorderWidth - radius: global.valueBorderRadius - } - - popup: Popup { - y: valueCombo.height - 1 - width: valueCombo.width - implicitHeight: contentItem.implicitHeight + 2 - padding: 1 - - contentItem: ListView { - clip: true - implicitHeight: contentHeight - model: valueCombo.popup.visible ? valueCombo.delegateModel : null - currentIndex: valueCombo.highlightedIndex - - ScrollIndicator.vertical: ScrollIndicator { } - } - - background: Rectangle { - color: global.color - border.color: global.colorBorderHighight - radius: global.valueBorderRadius - } - } } } diff --git a/scripts/developer/utilities/lib/prop/PropGroup.qml b/scripts/developer/utilities/lib/prop/PropGroup.qml index 39294743b6..dd579af7eb 100644 --- a/scripts/developer/utilities/lib/prop/PropGroup.qml +++ b/scripts/developer/utilities/lib/prop/PropGroup.qml @@ -25,6 +25,19 @@ Item { property var label: "group" + /* Component.onCompleted: { + var component1 = Qt.createComponent("PropBool.qml"); + component1.label = "Test"; + for (var i=0; i