mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:57:00 +02:00
ANd fuck
This commit is contained in:
parent
fe23ef1485
commit
3d2614498b
7 changed files with 307 additions and 0 deletions
35
scripts/developer/utilities/lib/prop/PropBool.qml
Normal file
35
scripts/developer/utilities/lib/prop/PropBool.qml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// PropBool.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 controlsUit 1.0 as HifiControls
|
||||||
|
|
||||||
|
PropItem {
|
||||||
|
Global { id: global }
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property alias valueVar : checkboxControl.checked
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
valueVar = root.valueVarGetter();
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControls.CheckBox {
|
||||||
|
id: checkboxControl
|
||||||
|
|
||||||
|
anchors.left: root.splitter.right
|
||||||
|
anchors.verticalCenter: root.verticalCenter
|
||||||
|
width: root.width * global.valueAreaWidthScale
|
||||||
|
height: global.slimHeight
|
||||||
|
|
||||||
|
checked: root.valueVar
|
||||||
|
onCheckedChanged: { root.valueVarSetter(checked); }
|
||||||
|
}
|
||||||
|
}
|
60
scripts/developer/utilities/lib/prop/PropGroup.qml
Normal file
60
scripts/developer/utilities/lib/prop/PropGroup.qml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
//
|
||||||
|
// PropGroup.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
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Global { id: global }
|
||||||
|
id: root
|
||||||
|
|
||||||
|
// Prop Group is designed to author an array of ProItems, they are defined with an array of the tuplets describing each individual item:
|
||||||
|
// [ ..., PropItemInfo, ...]
|
||||||
|
// PropItemInfo {
|
||||||
|
// "type": "PropXXXX", "object": object, "property": "propName"
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
property var propItems: []
|
||||||
|
|
||||||
|
|
||||||
|
property var label: "group"
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: column
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
PropLabel {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
text: root.label
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var component = Qt.createComponent("PropBool.qml");
|
||||||
|
component.label = "Test";
|
||||||
|
for (var i=0; i<propItems.length; i++) {
|
||||||
|
// if (propItems[i]["type"] == "PropBool") {
|
||||||
|
var component = Qt.createComponent("PropBool.qml");
|
||||||
|
component.label = propItems[i]["property"];
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PropItem is stretching horizontally accross its parent
|
||||||
|
// Fixed height
|
||||||
|
//anchors.left: parent.left
|
||||||
|
//anchors.right: parent.right
|
||||||
|
// height: global.lineHeight * propItems.length + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
44
scripts/developer/utilities/lib/prop/style/Global.qml
Normal file
44
scripts/developer/utilities/lib/prop/style/Global.qml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
//
|
||||||
|
// Prop/style/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.45
|
||||||
|
property real splitterWidth: 8
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
98
scripts/developer/utilities/lib/prop/style/PiComboBox.qml
Normal file
98
scripts/developer/utilities/lib/prop/style/PiComboBox.qml
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
//
|
||||||
|
// Prop/style/PsComboBox.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 QtQuick.Controls 2.2
|
||||||
|
|
||||||
|
|
||||||
|
ComboBox {
|
||||||
|
id: valueCombo
|
||||||
|
|
||||||
|
height: global.slimHeight
|
||||||
|
|
||||||
|
|
||||||
|
// look
|
||||||
|
flat: true
|
||||||
|
delegate: ItemDelegate {
|
||||||
|
width: valueCombo.width
|
||||||
|
height: valueCombo.height
|
||||||
|
contentItem: PiText {
|
||||||
|
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: PiText {
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
scripts/developer/utilities/lib/prop/style/PiLabel.qml
Normal file
25
scripts/developer/utilities/lib/prop/style/PiLabel.qml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Prop/style/PsLabel.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 QtQuick.Controls 2.2
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Global { id: global }
|
||||||
|
|
||||||
|
color: global.fontColor
|
||||||
|
font.pixelSize: global.fontSize
|
||||||
|
font.family: global.fontFamily
|
||||||
|
font.weight: global.fontWeight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: global.labelTextAlign
|
||||||
|
elide: global.labelTextElide
|
||||||
|
}
|
||||||
|
|
21
scripts/developer/utilities/lib/prop/style/PiSplitter.qml
Normal file
21
scripts/developer/utilities/lib/prop/style/PiSplitter.qml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Prop/style/Splitter.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
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
property real size
|
||||||
|
|
||||||
|
width: size // Must be non-zero
|
||||||
|
height: size
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
24
scripts/developer/utilities/lib/prop/style/PiText.qml
Normal file
24
scripts/developer/utilities/lib/prop/style/PiText.qml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
//
|
||||||
|
// Prop/style/PsText.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
|
||||||
|
|
||||||
|
Text {
|
||||||
|
Global { id: global }
|
||||||
|
|
||||||
|
color: global.fontColor
|
||||||
|
font.pixelSize: global.fontSize
|
||||||
|
font.family: global.fontFamily
|
||||||
|
font.weight: global.fontWeight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: global.labelTextAlign
|
||||||
|
elide: global.labelTextElide
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue