qml ui fixes

This commit is contained in:
pokamest 2021-08-19 01:27:22 +03:00
parent 57234bc793
commit 27171ed974
43 changed files with 311 additions and 262 deletions

View file

@ -0,0 +1,14 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
Button {
id: root
hoverEnabled: true
property bool containsMouse: hovered
MouseArea {
id: mouseArea
anchors.fill: parent
enabled: false
cursorShape: Qt.PointingHandCursor
}
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
background: Rectangle {
anchors.fill: parent
radius: 4
color: root.containsMouse ? "#211966" : "#100A44"
}
font.pixelSize: 16
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: root.font.pixelSize
color: "#D4D4D4"
text: root.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
CheckBox {
id: root
indicator: Image {
// y: 5
anchors.verticalCenter: root.verticalCenter
height: 20
width: 20
source: root.checked ? "qrc:/images/controls/check_on.png"
: "qrc:/images/controls/check_off.png"
}
contentItem: Text {
text: root.text
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
verticalAlignment: Text.AlignVCenter
leftPadding: root.indicator.width + root.spacing
}
}

View file

@ -0,0 +1,9 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
ComboBox {
id: root
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 13
}

View file

@ -0,0 +1,14 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
property alias iconMargin: img.anchors.margins
background: Item {}
contentItem: Image {
id: img
source: root.icon.source
anchors.fill: root
anchors.margins: root.containsMouse ? 3 : 4
}
}

View file

@ -0,0 +1,12 @@
import QtQuick 2.12
Text {
id: root
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}

View file

@ -0,0 +1,36 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
RadioButton {
id: root
indicator: Rectangle {
implicitWidth: 13
implicitHeight: 13
x: root.leftPadding
y: parent.height / 2 - height / 2
radius: 13
border.color: root.down ? "#777777" : "#777777"
Rectangle {
width: 7
height: 7
x: 3
y: 3
radius: 4
color: root.down ? "#15CDCB" : "#15CDCB"
visible: root.checked
}
}
contentItem: Text {
text: root.text
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 16
color: "#181922"
verticalAlignment: Text.AlignVCenter
leftPadding: root.indicator.width + root.spacing
}
height: 10
}

View file

@ -0,0 +1,26 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
background: Item {}
contentItem: Item {
anchors.fill: parent
Image {
source: root.icon.source
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
}
Text {
anchors.fill: parent
leftPadding: 30
text: root.text
color: root.enabled ? "#100A44": "#AAAAAA"
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 20
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
BasicButtonType {
id: root
background: Rectangle {
anchors.fill: parent
radius: 4
color: root.containsMouse ? "#282932" : "#181922"
}
font.pixelSize: 16
contentItem: Text {
anchors.fill: parent
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: root.font.pixelSize
color: "#D4D4D4"
text: root.text
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
antialiasing: true
}

View file

@ -0,0 +1,75 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.12
Item {
id: root
property bool active: false
property Component content: undefined
property string text: ""
width: 360
height: active ? contentLoader.item.height + 40 + 5 * 2 : 40
signal clicked()
Rectangle {
x: 0
y: 0
width: parent.width
height: 40
color: "transparent"
clip: true
radius: 2
LinearGradient {
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(0, height)
gradient: Gradient {
GradientStop { position: 0.0; color: "#E1E1E1" }
GradientStop { position: 0.4; color: "#DDDDDD" }
GradientStop { position: 0.5; color: "#D8D8D8" }
GradientStop { position: 1.0; color: "#D3D3D3" }
}
}
Image {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
source: "qrc:/images/share.png"
}
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 2
color: "#148CD2"
visible: ms.containsMouse ? true : false
}
Text {
x: 40
anchors.verticalCenter: parent.verticalCenter
font.family: "Lato"
font.styleName: "normal"
font.pixelSize: 18
color: "#100A44"
font.bold: true
text: root.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}
MouseArea {
id: ms
anchors.fill: parent
hoverEnabled: true
onClicked: root.clicked()
}
}
Loader {
x: 0
y: 40 + 5
id: contentLoader
sourceComponent: root.content
visible: root.active
}
}

View file

@ -0,0 +1,34 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
TextField {
id: root
property bool error: false
// font.
selectionColor: "darkgray"
font.pixelSize: 16
color: "#333333"
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
border.width: 1
color: {
if (root.error) {
return Qt.rgba(213, 40, 60, 255)
}
return root.enabled ? "#F4F4F4" : Qt.rgba(127, 127, 127, 255)
}
border.color: {
if (!root.enabled) {
return Qt.rgba(127, 127, 127, 255)
}
if (root.error) {
return Qt.rgba(213, 40, 60, 255)
}
if (root.focus) {
return "#A7A7A7"
}
return "#A7A7A7"
}
}
}