Skip to content

Commit

Permalink
remove disabled property on MMButton and MMRoundButton
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Apr 16, 2024
1 parent c01cb81 commit 67363aa
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 26 deletions.
10 changes: 5 additions & 5 deletions app/qml/account/MMHowYouFoundUsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ MMPage {

text: qsTr("Continue")

disabled: {
if ( listView.currentIndex < 0 ) return true
if ( listView.model.get(listView.currentIndex).key === "social" ) return true
if ( ( listView.model.get(listView.currentIndex).key === "other" ) && root.selectedText === "" ) return true
return false
enabled: {
if ( listView.currentIndex < 0 ) return false
if ( listView.model.get(listView.currentIndex).key === "social" ) return false
if ( ( listView.model.get(listView.currentIndex).key === "other" ) && root.selectedText === "" ) return false
return true
}

onClicked: {
Expand Down
4 changes: 2 additions & 2 deletions app/qml/account/MMLoginPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ MMPage {

text: qsTr( "Sign in" )

disabled: root.pending
enabled: !root.pending

onClicked: root.signInClicked( username.text, password.text )
}
Expand All @@ -134,7 +134,7 @@ MMPage {

type: MMButton.Types.Secondary

disabled: root.pending
enabled: !root.pending

onClicked: root.signUpClicked()
}
Expand Down
2 changes: 1 addition & 1 deletion app/qml/account/MMSignUpPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ MMPage {

text: qsTr( "Sign up" )

disabled: root.pending
enabled: !root.pending

onClicked: {
root.signUpClicked(
Expand Down
8 changes: 4 additions & 4 deletions app/qml/account/MMWhichIndustryPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ MMPage {

text: qsTr("Continue")

disabled: {
if ( gridView.currentIndex < 0 ) return true
if ( ( gridView.model.get(gridView.currentIndex).key === "other" ) && root.selectedText === "" ) return true
return false
enabled: {
if ( gridView.currentIndex < 0 ) return false
if ( ( gridView.model.get(gridView.currentIndex).key === "other" ) && root.selectedText === "" ) return false
return true
}

onClicked: {
Expand Down
9 changes: 3 additions & 6 deletions app/qml/components/MMButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@ Button {
if ( type === MMButton.Types.Tertiary ) return __style.transparentColor
}

property bool disabled: false

property string iconSourceRight
property string iconSourceLeft

states: [
State {
name: "default"
when: !root.hovered && !root.disabled
when: !root.hovered && root.enabled

PropertyChanges {
target: buttonContent
Expand All @@ -107,7 +105,7 @@ Button {

State {
name: "hovered"
when: root.hovered && !root.disabled
when: root.hovered && root.enabled

PropertyChanges {
target: buttonContent
Expand All @@ -134,7 +132,7 @@ Button {

State {
name: "disabled"
when: root.disabled
when: !root.enabled

PropertyChanges {
target: buttonContent
Expand All @@ -161,7 +159,6 @@ Button {
]

state: "default"
enabled: !disabled

implicitHeight: root.type === MMButton.Types.Tertiary ? buttonContent.height : buttonContent.height + topPadding + bottomPadding
implicitWidth: row.paintedChildrenWidth + 2 * __style.margin20
Expand Down
4 changes: 0 additions & 4 deletions app/qml/components/MMRoundButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ RoundButton {
property color bgndColor: __style.polarColor
property color bgndHoverColor: __style.mediumGreenColor

property bool disabled: false

enabled: !disabled

contentItem: MMIcon {
color: root.iconColor
source: root.iconSource
Expand Down
2 changes: 1 addition & 1 deletion app/qml/dialogs/MMCloseAccountDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ MMDrawer {
fontColorDisabled: __style.negativeColor
bgndColorDisabled: __style.negativeLightColor

disabled: usernameInput.text !== root.username
enabled: usernameInput.text === root.username

onClicked: {
close()
Expand Down
6 changes: 3 additions & 3 deletions gallery/qml/pages/ButtonsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ScrollView {

width: parent.width / 2 - parent.spacing

disabled: true
enabled: false

onClicked: text = (text === "Clicked" ? "Primary" : "Clicked")
}
Expand Down Expand Up @@ -119,7 +119,7 @@ ScrollView {
width: parent.width / 2 - parent.spacing

type: MMButton.Types.Secondary
disabled: true
enabled: false

onClicked: text = (text === "Clicked" ? "Secondary" : "Clicked")
}
Expand Down Expand Up @@ -177,7 +177,7 @@ ScrollView {
width: parent.width / 2 - parent.spacing

type: MMButton.Types.Tertiary
disabled: true
enabled: false

iconSourceLeft: __style.uploadIcon

Expand Down

0 comments on commit 67363aa

Please sign in to comment.