Particle Editor Demo
import Felgo 3.0
import QtQuick 2.0
import QtQuick.Controls.Styles 1.1
Item {
property alias buttonStyle:buttonStyleComponent
property alias switchStyle:switchStyleComponent
property alias sliderStyle:sliderStyleComponent
property alias textFieldStyle:textFieldStyleComponent
property alias scrollViewStyle:scrollViewStyleComponent
property alias itemEditorStyle:itemEditorStyle
property color windowBackgroundColor: "#212126"
property color elementBackgroundColor: "#2c2b2a"
property color elementForegroundColor: "#413d3c"
property color elementHighlightColor: Qt.lighter("#468bb7", 1.2)
property color elementNormalColor: Qt.darker("#468bb7", 1.4)
property color buttonTextColor: "white"
property int buttonTextPixelSize: 12
property color switchTextColor: "white"
property int switchTextPixelSize: 11
property color textFieldTextColor: "white"
property color textFieldPlaceholderTextColor: "grey"
property int textFieldTextPixelSize: 14
property color itemEditorLabelTextColor: "white"
property int itemEditorLabelTextPixelSize: 11
property alias itemEditorLabel: itemEditorLabel
Component {
id: buttonStyleComponent
ButtonStyle {
panel: MultiResolutionImage {
implicitHeight: 27
implicitWidth: 69
scale: control.pressed ? 0.9 : 1
source: "../assets/img/button.png"
Text {
text: control.text
anchors.centerIn: parent
color: buttonTextColor
font.pixelSize: buttonTextPixelSize
renderType: Text.QtRendering
}
}
}
}
Component {
id: switchStyleComponent
SwitchStyle {
groove: Item {
implicitHeight: 18
implicitWidth: 54
MultiResolutionImage {
implicitHeight: 18
implicitWidth: 78
source: control.checked ? "../assets/img/switch-on.png" : "../assets/img/switch-off.png"
}
}
handle: MultiResolutionImage {
implicitHeight: 16
implicitWidth: 25
source: "../assets/img/switch-thumb.png"
}
}
}
Component {
id: sliderStyleComponent
SliderStyle {
handle: MultiResolutionImage {
implicitHeight: 38
implicitWidth: 38
source: "../assets/img/slider-handle.png"
}
groove: MultiResolutionImage {
implicitHeight: 20
implicitWidth: 185
source: "../assets/img/slider-background.png"
Rectangle {
z: -1
anchors.verticalCenter: parent.verticalCenter
antialiasing: true
radius: 1
color: elementHighlightColor
height: 4
width: styleData.handlePosition+5
}
}
}
}
Component {
id: textFieldStyleComponent
TextFieldStyle {
renderType: Text.QtRendering
textColor: textFieldTextColor
font.pixelSize: textFieldTextPixelSize
padding { top: 0 ; left: Math.round(control.__contentHeight/3) ; right: control.__contentHeight/3 ; bottom: 0 }
background: Item {
implicitHeight: 25
implicitWidth: 160
MultiResolutionImage {
source: "../assets/img/textinput.png"
implicitHeight: 6
implicitWidth: 160
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
}
}
}
}
Component {
id: scrollViewStyleComponent
ScrollViewStyle {
transientScrollBars: true
handle: Item {
implicitWidth: 7
implicitHeight: 13
Rectangle {
color: elementBackgroundColor
anchors.fill: parent
anchors.topMargin: 3
anchors.leftMargin: 2
anchors.rightMargin: 2
anchors.bottomMargin: 3
Rectangle {
color: elementForegroundColor
anchors.fill: parent
anchors.topMargin: 1
anchors.leftMargin: 1
anchors.rightMargin: 1
anchors.bottomMargin: 1
}
}
}
scrollBarBackground: Item {
implicitWidth: 7
implicitHeight: 13
}
}
}
ItemEditorStyle {
id: itemEditorStyle
contentDelegateBackground: MultiResolutionImage {
source: "../assets/img/window.png"
anchors.fill: parent
}
contentDelegateTypeList: MultiResolutionImage {
source: "../assets/img/window.png"
anchors.fill: parent
}
label: Text {
id: itemEditorLabel
color: itemEditorLabelTextColor
font.pixelSize: itemEditorLabelTextPixelSize