Merge pull request #1854

548bc5f CheckBox: iconOnTheLeft property, optional uncheckedIcon and border, rich text format (xiphon)
This commit is contained in:
luigi1111 2018-12-26 16:09:24 -06:00
commit f5b684811c
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

View File

@ -38,8 +38,10 @@ Item {
property string uncheckedIcon property string uncheckedIcon
property bool checked: false property bool checked: false
property alias background: backgroundRect.color property alias background: backgroundRect.color
property bool border: true
property int fontSize: 14 * scaleRatio property int fontSize: 14 * scaleRatio
property alias fontColor: label.color property alias fontColor: label.color
property bool iconOnTheLeft: true
signal clicked() signal clicked()
height: 25 * scaleRatio height: 25 * scaleRatio
width: checkBoxLayout.width width: checkBoxLayout.width
@ -51,6 +53,8 @@ Item {
RowLayout { RowLayout {
id: checkBoxLayout id: checkBoxLayout
layoutDirection: iconOnTheLeft ? Qt.LeftToRight : Qt.RightToLeft
spacing: (!isMobile ? 10 : 8) * scaleRatio
Item { Item {
id: checkMark id: checkMark
@ -68,12 +72,18 @@ Item {
} else { } else {
return MoneroComponents.Style.inputBorderColorInActive; return MoneroComponents.Style.inputBorderColorInActive;
} }
visible: checkBox.border
} }
Image { Image {
anchors.centerIn: parent anchors.centerIn: parent
source: checkBox.checkedIcon source: {
visible: checkBox.checked if (checkBox.checked || checkBox.uncheckedIcon == "") {
return checkBox.checkedIcon;
}
return checkBox.uncheckedIcon;
}
visible: checkBox.checked || checkBox.uncheckedIcon != ""
} }
} }
@ -82,8 +92,8 @@ Item {
font.family: MoneroComponents.Style.fontRegular.name font.family: MoneroComponents.Style.fontRegular.name
font.pixelSize: checkBox.fontSize font.pixelSize: checkBox.fontSize
color: MoneroComponents.Style.defaultFontColor color: MoneroComponents.Style.defaultFontColor
textFormat: Text.RichText
wrapMode: Text.Wrap wrapMode: Text.Wrap
Layout.leftMargin: !isMobile ? 10 : 8
} }
} }