Squaby Demo
import Felgo 4.0
import QtQuick 2.0
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 {
contentItem: MultiResolutionImage {
implicitHeight: 27
implicitWidth: 69
scale: control.pressed ? 0.9 : 1
source: Qt.resolvedUrl("../../assets/img/buttons.png")
Text {
text: control.text
anchors.centerIn: parent
color: buttonTextColor
font.pixelSize: buttonTextPixelSize
renderType: Text.QtRendering
}
}
}
}
Component {
id: switchStyleComponent
SwitchStyle {
background: 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: Qt.resolvedUrl("../../assets/img/switch-thumb.png")
}
}
}
Component {
id: sliderStyleComponent
SliderStyle {
handle: MultiResolutionImage {
implicitHeight: 38
implicitWidth: 38
source: Qt.resolvedUrl("../../assets/img/slider-handle.png")
}
background: MultiResolutionImage {
implicitHeight: 35
implicitWidth: 277
source: Qt.resolvedUrl("../../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: Qt.resolvedUrl("../../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: Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "#6a93c1" }
GradientStop { position: 1.0; color: "#38587b" }
}
}
contentDelegateTypeList: Rectangle {
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: "#6a93c1" }
GradientStop { position: 1.0; color: "#38587b" }
}
}
label: Text {
id: itemEditorLabel
color: itemEditorLabelTextColor
font.pixelSize: itemEditorLabelTextPixelSize