Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

standard-button: handle changing text/icon at runtime #1809

Merged
merged 1 commit into from
Dec 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions components/StandardButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Item {

height: small ? 30 * scaleRatio : 36 * scaleRatio
width: buttonLayout.width + 22 * scaleRatio
Component.onCompleted: width = width
implicitHeight: height
implicitWidth: width

function doClick() {
// Android workaround
Expand Down Expand Up @@ -106,9 +107,21 @@ Item {
horizontalAlignment: textAlign === "center" ? Text.AlignHCenter : Text.AlignLeft
font.family: MoneroComponents.Style.fontBold.name
font.bold: true
font.pixelSize: buttonArea.pressed ? button.fontSize - 1 : button.fontSize
color: button.textColor
font.pixelSize: button.fontSize
color: !buttonArea.pressed ? button.textColor : "transparent"
visible: text !== ""

Text {
anchors.fill: parent
color: button.textColor
font.bold: label.font.bold
font.family: label.font.family
font.pixelSize: label.font.pixelSize - 1
horizontalAlignment: label.horizontalAlignment
Layout.alignment: label.Layout.alignment
text: label.text
visible: buttonArea.pressed
}
}

Image {
Expand Down