Style code
This commit is contained in:
@@ -2,14 +2,16 @@ import QtQuick
|
||||
import QtQuick.Templates as T
|
||||
import QtQuick.Controls
|
||||
|
||||
T.ComboBox {
|
||||
T.ComboBox
|
||||
{
|
||||
id: control
|
||||
|
||||
font: Typography.body
|
||||
implicitHeight: background.height
|
||||
padding: Dimensions.m
|
||||
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
border.color: Colors.interactive
|
||||
border.width: 1
|
||||
color: Colors.mantle
|
||||
@@ -17,12 +19,14 @@ T.ComboBox {
|
||||
radius: Dimensions.radius
|
||||
}
|
||||
|
||||
delegate: T.ItemDelegate {
|
||||
delegate: T.ItemDelegate
|
||||
{
|
||||
width: control.width
|
||||
height: implicitContentHeight + topPadding + bottomPadding
|
||||
padding: Dimensions.s
|
||||
leftPadding: control.leftPadding
|
||||
contentItem: Label {
|
||||
contentItem: Label
|
||||
{
|
||||
text: control.textRole ? model[control.textRole] : modelData
|
||||
color: Colors.foreground
|
||||
elide: Text.ElideRight
|
||||
@@ -30,7 +34,8 @@ T.ComboBox {
|
||||
}
|
||||
highlighted: control.highlightedIndex === index
|
||||
}
|
||||
indicator: Label {
|
||||
indicator: Label
|
||||
{
|
||||
x: control.width - width
|
||||
height: control.height
|
||||
width: contentWidth + Dimensions.s * 2
|
||||
@@ -39,7 +44,8 @@ T.ComboBox {
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
padding: Dimensions.s
|
||||
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: Colors.primary
|
||||
topRightRadius: Dimensions.radius
|
||||
@@ -48,17 +54,20 @@ T.ComboBox {
|
||||
}
|
||||
}
|
||||
|
||||
popup: T.Popup {
|
||||
popup: T.Popup
|
||||
{
|
||||
y: control.height
|
||||
z: 2
|
||||
width: control.width
|
||||
contentItem: ListView {
|
||||
contentItem: ListView
|
||||
{
|
||||
clip: true
|
||||
implicitHeight: contentHeight
|
||||
model: control.popup.visible ? control.delegateModel : null
|
||||
currentIndex: control.highlightedIndex
|
||||
|
||||
highlight: Rectangle {
|
||||
highlight: Rectangle
|
||||
{
|
||||
color: Colors.primary
|
||||
opacity: Colors.highlightOpacity
|
||||
}
|
||||
@@ -66,10 +75,11 @@ T.ComboBox {
|
||||
ScrollIndicator.vertical: ScrollIndicator {}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
color: Colors.mantle
|
||||
border.color: Colors.interactive
|
||||
radius: Dimensions.radius
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
QtObject
|
||||
{
|
||||
/**
|
||||
* Distance for objects that are tied to each other,
|
||||
* e.g. a field and its label.
|
||||
@@ -22,4 +23,4 @@ QtObject {
|
||||
readonly property int l: 30
|
||||
|
||||
readonly property int radius: 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
ColumnLayout {
|
||||
ColumnLayout
|
||||
{
|
||||
required property string label
|
||||
spacing: Dimensions.s
|
||||
|
||||
Label {
|
||||
Label
|
||||
{
|
||||
text: label
|
||||
font: Typography.body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates as T
|
||||
|
||||
T.TextField {
|
||||
T.TextField
|
||||
{
|
||||
id: control
|
||||
background: Rectangle {
|
||||
background: Rectangle
|
||||
{
|
||||
id: background
|
||||
color: Colors.mantle
|
||||
radius: Dimensions.radius
|
||||
@@ -16,5 +18,6 @@ T.TextField {
|
||||
implicitHeight: background.height
|
||||
placeholderTextColor: Colors.interactive
|
||||
font: Typography.body
|
||||
padding: Dimensions.m
|
||||
}
|
||||
padding: Dimensions.s
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,15 @@ pragma Singleton
|
||||
import QtCore
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
readonly property FontLoader robotoCondensed: FontLoader {
|
||||
Item
|
||||
{
|
||||
readonly property FontLoader robotoCondensed: FontLoader
|
||||
{
|
||||
source: "qrc:/fonts/RobotoCondensed.otf"
|
||||
}
|
||||
|
||||
readonly property font body: ({
|
||||
readonly property font body:
|
||||
({
|
||||
family: robotoCondensed.font,
|
||||
pointSize: 16,
|
||||
weight: Font.Medium,
|
||||
@@ -16,11 +19,12 @@ Item {
|
||||
kerning: true,
|
||||
})
|
||||
|
||||
readonly property font h1: ({
|
||||
readonly property font h1:
|
||||
({
|
||||
family: body.family,
|
||||
pointSize: 38,
|
||||
weight: body.weight,
|
||||
letterSpacing: body.letterSpacing,
|
||||
kerning: body.kerning,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user