feat: introduce StatusRadioButton component

This commit is contained in:
Pascal Precht 2020-09-17 17:55:09 +02:00 committed by Iuri Matias
parent c6cc426f22
commit 44e3e6d581
5 changed files with 40 additions and 27 deletions

View File

@ -3,6 +3,7 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../../../imports"
import "../../../../../shared"
import "../../../../../shared/status"
Rectangle {
property string name: "Jotaro Kujo"
@ -143,7 +144,7 @@ Rectangle {
}
}
RadioButton {
StatusRadioButton {
visible: selectable
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding

View File

@ -3,6 +3,7 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
Item {
id: syncContainer
@ -24,31 +25,8 @@ Item {
Component {
id: mailserversList
RadioButton {
id: control
indicator: Rectangle {
implicitWidth: 26
implicitHeight: 26
x: control.leftPadding
y: parent.height / 2 - height / 2
radius: 13
border.color: control.down ? "#17a81a" : "#21be2b"
Rectangle {
width: 14
height: 14
x: 6
y: 6
radius: 7
color: control.down ? "#17a81a" : "#21be2b"
visible: control.checked
}
}
contentItem: StyledText {
text: name
color: Style.current.textColor
leftPadding: control.indicator.width + control.spacing
}
StatusRadioButton {
text: name
checked: index == 0 ? true: false
}
}

View File

@ -2,6 +2,7 @@ import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
import "../data/"
Item {
@ -39,7 +40,7 @@ Item {
font.pixelSize: 15
}
RadioButton {
StatusRadioButton {
checked: currency === key
anchors.right: parent.right
anchors.rightMargin: 4

View File

@ -0,0 +1,32 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQml 2.14
import "../../imports"
import "../../shared"
RadioButton {
id: control
indicator: Rectangle {
implicitWidth: 20
implicitHeight: 20
x: control.leftPadding
y: 4
radius: 10
color: control.checked ? Style.current.blue : Style.current.grey
Rectangle {
width: 12
height: 12
radius: 6
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: control.checked ? Style.current.white : Style.current.grey
visible: control.checked
}
}
contentItem: StyledText {
text: control.text
color: Style.current.textColor
leftPadding: control.indicator.width + control.spacing
}
}

View File

@ -1,3 +1,4 @@
StatusButton 1.0 StatusButton.qml
StatusRadioButton 1.0 StatusRadioButton.qml
StatusRoundButton 1.0 StatusRoundButton.qml
StatusSlider 1.0 StatusSlider.qml