Skip to content

Commit

Permalink
Applied review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Dec 19, 2023
1 parent 4349dec commit e4bb84e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
22 changes: 4 additions & 18 deletions app/qml/components/MMSwitch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,29 @@

import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic

Switch {
id: control

property string textOn
property string textOff
property bool visibleText: true

contentItem: Text {
text: {
if(control.visibleText) {
if(control.textOn.length > 0 && control.textOff.length > 0) {
if(control.checked)
return control.textOn
return control.textOff
}
return control.text
}
}
text: control.text
font: __style.p5
color: control.enabled ? __style.forestColor : __style.mediumGreenColor
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}

indicator: Rectangle {
implicitWidth: 48
implicitHeight: 28
implicitWidth: 48 * __dp
implicitHeight: 28 * __dp
x: control.leftPadding
y: parent.height / 2 - height / 2
radius: implicitHeight / 2
color: control.checked ? __style.grassColor : __style.whiteColor

Rectangle {
x: control.checked ? parent.width - width - radius/2 : radius/2
width: 20
width: 20 * __dp
height: width
radius: width / 2
color: control.enabled ? __style.forestColor : __style.mediumGreenColor
Expand Down
5 changes: 0 additions & 5 deletions app/qml/inputs/MMSwitchEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import "../components"

MMAbstractEditor {
Expand Down Expand Up @@ -49,9 +47,6 @@ MMAbstractEditor {
x: -30 * __dp

checked: root.checked
textOn: root.textOn
textOff: root.textOff
visibleText: false

onCheckedChanged: focus = true
}
Expand Down
3 changes: 1 addition & 2 deletions gallery/qml/pages/ChecksPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ Column {
spacing: 20
anchors.fill: parent
MMSwitch {
textOn: "ON"
textOff: "OFF"
checked: false
text: checked ? "ON" : "OFF"
}
MMSwitch {
text: "static"
Expand Down

1 comment on commit e4bb84e

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.12.500411 just submitted!

Please sign in to comment.