mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
checkbox redesign
This commit is contained in:
parent
0e6028aacf
commit
085dfe114a
1 changed files with 50 additions and 41 deletions
|
@ -29,25 +29,29 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
Item {
|
||||
RowLayout {
|
||||
id: checkBox
|
||||
property alias text: label.text
|
||||
property string checkedIcon
|
||||
property string uncheckedIcon
|
||||
property bool checked: false
|
||||
property alias background: backgroundRect.color
|
||||
property int fontSize: 14
|
||||
property int fontSize: 14 * scaleRatio
|
||||
property alias fontColor: label.color
|
||||
signal clicked()
|
||||
height: 25
|
||||
width: label.x + label.width
|
||||
Layout.minimumWidth: label.x + label.contentWidth
|
||||
clip: true
|
||||
height: 25 * scaleRatio
|
||||
|
||||
function toggle(){
|
||||
checkBox.checked = !checkBox.checked
|
||||
checkBox.clicked()
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Rectangle {
|
||||
anchors.left: parent.left
|
||||
height: parent.height - 1
|
||||
width: 25
|
||||
width: 25 * scaleRatio
|
||||
height: checkBox.height - 1
|
||||
//radius: 4
|
||||
y: 0
|
||||
color: "#DBDBDB"
|
||||
|
@ -56,8 +60,8 @@ Item {
|
|||
Rectangle {
|
||||
id: backgroundRect
|
||||
anchors.left: parent.left
|
||||
height: parent.height - 1
|
||||
width: 25
|
||||
width: 25 * scaleRatio
|
||||
height: checkBox.height - 1
|
||||
//radius: 4
|
||||
y: 1
|
||||
color: "#FFFFFF"
|
||||
|
@ -67,23 +71,28 @@ Item {
|
|||
source: checkBox.checked ? checkBox.checkedIcon :
|
||||
checkBox.uncheckedIcon
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: label
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 25 + 12
|
||||
font.family: "Arial"
|
||||
font.pixelSize: checkBox.fontSize
|
||||
color: "#525252"
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
checkBox.checked = !checkBox.checked
|
||||
checkBox.clicked()
|
||||
toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: label
|
||||
font.family: "Arial"
|
||||
font.pixelSize: checkBox.fontSize
|
||||
color: "#525252"
|
||||
wrapMode: Text.Wrap
|
||||
Layout.fillWidth: true
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue