chore: add StatusRadioButton

Closes #11
This commit is contained in:
B.Melnik 2021-05-20 09:45:05 +03:00 committed by Michał Cieślak
parent f185b892ea
commit 96a5b3b55a
4 changed files with 46 additions and 1 deletions

View File

@ -89,4 +89,8 @@ GridLayout {
StatusSwitch {
}
StatusRadioButton {
text: "i'm radio!"
}
}

View File

@ -36,3 +36,4 @@ DISTFILES += \
../src/StatusQ/Controls/StatusButton.qml \
../src/StatusQ/Controls/StatusFlatRoundButton.qml \
../src/StatusQ/Controls/StatusSwitch.qml
../src/StatusQ/Controls/StatusRadioButton.qml

View File

@ -0,0 +1,40 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQml 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
RadioButton {
id: statusRadioButton
width: indicator.implicitWidth
indicator: Rectangle {
implicitWidth: 20
implicitHeight: 20
x: 0
y: 6
radius: 10
color: statusRadioButton.checked ? Theme.palette.primaryColor1
: Theme.palette.directColor8
Rectangle {
width: 12
height: 12
radius: 6
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: statusRadioButton.checked ? Theme.palette.white : "transparent"
visible: statusRadioButton.checked
}
}
contentItem: StatusBaseText {
text: statusRadioButton.text
verticalAlignment: Text.AlignVCenter
leftPadding: !!statusRadioButton.text ? statusRadioButton.indicator.width + statusRadioButton.spacing
: statusRadioButton.indicator.width
}
}

View File

@ -9,4 +9,4 @@ StatusFlatButton 0.1 StatusFlatButton.qml
StatusRoundButton 0.1 StatusRoundButton.qml
StatusFlatRoundButton 0.1 StatusFlatRoundButton.qml
StatusSwitch 0.1 StatusSwitch.qml
StatusRadioButton 0.1 StatusRadioButton.qml