diff --git a/sandbox/Controls.qml b/sandbox/Controls.qml index 1341ff67..8de794cd 100644 --- a/sandbox/Controls.qml +++ b/sandbox/Controls.qml @@ -85,4 +85,8 @@ GridLayout { tooltip.text: "Chat" badge.value: 100 } + + StatusRadioButton { + text: "i'm radio!" + } } diff --git a/sandbox/sandbox.pro b/sandbox/sandbox.pro index e3fe24c5..4fe8186c 100644 --- a/sandbox/sandbox.pro +++ b/sandbox/sandbox.pro @@ -33,4 +33,5 @@ HEADERS += \ DISTFILES += \ ../src/StatusQ/Controls/StatusBaseButton.qml \ ../src/StatusQ/Controls/StatusButton.qml \ - ../src/StatusQ/Controls/StatusFlatRoundButton.qml + ../src/StatusQ/Controls/StatusFlatRoundButton.qml \ + ../src/StatusQ/Controls/StatusRadioButton.qml diff --git a/src/StatusQ/Controls/StatusRadioButton.qml b/src/StatusQ/Controls/StatusRadioButton.qml new file mode 100644 index 00000000..b58eddbf --- /dev/null +++ b/src/StatusQ/Controls/StatusRadioButton.qml @@ -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 + } +} diff --git a/src/StatusQ/Controls/qmldir b/src/StatusQ/Controls/qmldir index d10d2d81..d7115c1f 100644 --- a/src/StatusQ/Controls/qmldir +++ b/src/StatusQ/Controls/qmldir @@ -8,4 +8,4 @@ StatusButton 0.1 StatusButton.qml StatusFlatButton 0.1 StatusFlatButton.qml StatusRoundButton 0.1 StatusRoundButton.qml StatusFlatRoundButton 0.1 StatusFlatRoundButton.qml - +StatusRadioButton 0.1 StatusRadioButton.qml