diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2018-12-07 18:59:59 -0600 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2018-12-07 18:59:59 -0600 |
| commit | 4a6762a4274d9cf044f2d9e390f981d493d7b6c9 (patch) | |
| tree | 994e7e82f75987277960aebabcc3c411689bed74 | |
| parent | cda7dcb484e4a45d3aa79d8a47aad05705328252 (diff) | |
| parent | f72b4073acd75c685a0e2847df80ec39bdd0cc16 (diff) | |
| download | monzero-gui-4a6762a4274d9cf044f2d9e390f981d493d7b6c9.tar.gz monzero-gui-4a6762a4274d9cf044f2d9e390f981d493d7b6c9.tar.xz monzero-gui-4a6762a4274d9cf044f2d9e390f981d493d7b6c9.zip | |
Merge pull request #1782
f72b407 checkbox: remove a gap between rectangle and text, fix layout (xiphon)
| -rw-r--r-- | components/CheckBox.qml | 70 |
1 files changed, 29 insertions, 41 deletions
diff --git a/components/CheckBox.qml b/components/CheckBox.qml index 72716150..52f863e4 100644 --- a/components/CheckBox.qml +++ b/components/CheckBox.qml @@ -31,7 +31,7 @@ import QtQuick.Layouts 1.1 import "../components" as MoneroComponents -RowLayout { +Item { id: checkBox property alias text: label.text property string checkedIcon: "../images/checkedIcon-black.png" @@ -42,6 +42,7 @@ RowLayout { property alias fontColor: label.color signal clicked() height: 25 * scaleRatio + width: checkBoxLayout.width function toggle(){ checkBox.checked = !checkBox.checked @@ -49,43 +50,31 @@ RowLayout { } RowLayout { - Layout.fillWidth: true - Rectangle { - anchors.left: parent.left - width: 25 * scaleRatio - height: checkBox.height - 1 - radius: 3 - y: 0 - color: "transparent" - border.color: - if(checkBox.checked){ - return MoneroComponents.Style.inputBorderColorActive; - } else { - return MoneroComponents.Style.inputBorderColorInActive; - } - } + id: checkBoxLayout + + Item { + id: checkMark + height: checkBox.height + width: checkBox.height - Rectangle { - id: backgroundRect - anchors.left: parent.left - width: 25 * scaleRatio - height: checkBox.height - 1 - y: 1 - color: "transparent" + Rectangle { + id: backgroundRect + anchors.fill: parent + radius: 3 + color: "transparent" + border.color: + if(checkBox.checked){ + return MoneroComponents.Style.inputBorderColorActive; + } else { + return MoneroComponents.Style.inputBorderColorInActive; + } + } Image { anchors.centerIn: parent source: checkBox.checkedIcon visible: checkBox.checked } - - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - toggle() - } - } } Text { @@ -94,16 +83,15 @@ RowLayout { font.pixelSize: checkBox.fontSize color: MoneroComponents.Style.defaultFontColor wrapMode: Text.Wrap - Layout.fillWidth: true - anchors.left: backgroundRect.right - anchors.leftMargin: !isMobile ? 10 : 8 - MouseArea { - anchors.fill: parent - cursorShape: Qt.PointingHandCursor - onClicked: { - toggle() - } - } + Layout.leftMargin: !isMobile ? 10 : 8 + } + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + toggle() } } } |
