fixed scaling bug of fancy button on window

This commit is contained in:
Dorian Zedler 2019-03-20 17:25:30 +01:00
parent 2ec52ac6e3
commit 552bee0213
3 changed files with 45 additions and 40 deletions

View file

@ -28,6 +28,10 @@ Button {
property real imageScale: 1
property color color: app.style.style.buttonColor
property int size: 100
height: control.size
width: control.size
scale: control.pressed ? 0.8:1
@ -37,7 +41,14 @@ Button {
}
}
background: Item {
onSizeChanged: {
control.width = control.size
control.height = control.size
console.log("Button: size: " + control.size + " height: " + control.height + " width: " + control.width)
}
background: Item {
id: controlBackgroundContainer
RectangularGlow {
@ -54,27 +65,30 @@ Button {
Rectangle {
id: controlBackground
anchors.fill: parent
anchors.centerIn: parent
radius: height * 0.5
height: control.height
width: control.width
radius: control.size * 0.5
color: control.color
Image {
id: buttonIcon
source: control.image
anchors.centerIn: parent
height: parent.height * 0.5
width: height
mipmap: true
fillMode: Image.PreserveAspectFit
scale: control.imageScale
}
}
}
Image {
id: buttonIcon
source: control.image
anchors.centerIn: parent
height: parent.height * 0.5
width: height
mipmap: true
fillMode: Image.PreserveAspectFit
scale: control.imageScale
}
}

View file

@ -161,7 +161,7 @@ Page {
background: Rectangle {
radius: 2
color: app.style.style.backgroundColor
color: classLetterCb.Material.dialogColor
layer.enabled: classLetterCb.enabled
// layer.effect: ElevationEffect {
@ -307,8 +307,7 @@ Page {
imageScale: 0
height: 50
width: height
size: 50
onClicked: {
filterDialog.createContact()

View file

@ -33,19 +33,18 @@ Page {
Column {
id: mainMenu
spacing: buttonWidth * 0.1
spacing: buttonSize * 0.1
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
property int buttonHeight: app.landscape() ? root.height * (0.5*0.8):buttonWidth
property int buttonWidth: app.landscape() ? buttonHeight:root.width * (0.5*0.8)
property int buttonSize: app.landscape() ? root.height * (0.5*0.8):root.width * (0.5*0.8)
Row {
id: bigMenu
spacing: mainMenu.buttonWidth * 0.1
spacing: mainMenu.buttonSize * 0.1
anchors.horizontalCenter: parent.horizontalCenter
FancyButton {
@ -53,8 +52,7 @@ Page {
image: "qrc:/graphics/icons/sheute.png"
width: mainMenu.buttonWidth
height: mainMenu.buttonHeight
size: mainMenu.buttonSize
onClicked: {
formStack.eventDay = 0
@ -67,8 +65,7 @@ Page {
image: "qrc:/graphics/icons/smorgen.png"
width: mainMenu.buttonWidth
height: mainMenu.buttonHeight
size: mainMenu.buttonSize
onClicked: {
formStack.eventDay = 1
@ -81,20 +78,18 @@ Page {
Grid {
id: smallMenu
columns: app.landscape() ? 4:2
spacing: mainMenu.buttonWidth * 0.1
spacing: mainMenu.buttonSize * 0.1
anchors.horizontalCenter: parent.horizontalCenter
property int buttonHeight: mainMenu.buttonHeight * 0.7
property int buttonWidth: mainMenu.buttonWidth * 0.7
property int buttonSize: mainMenu.buttonSize * 0.7
FancyButton {
id: foodplanButton
image: app.style.style.treffpunktFannyIcon
width: smallMenu.buttonWidth
height: smallMenu.buttonHeight
size: smallMenu.buttonSize
onClicked: {
formStack.push(foodPlanForm)
@ -107,8 +102,7 @@ Page {
image: app.style.style.fannyLogo
imageScale: 1.2
width: smallMenu.buttonWidth
height: smallMenu.buttonHeight
size: smallMenu.buttonSize
onClicked: {
Qt.openUrlExternally("http://www.fanny-leicht.de")
@ -121,8 +115,7 @@ Page {
image: app.style.style.settingsIcon
imageScale: 0.8
width: smallMenu.buttonWidth
height: smallMenu.buttonHeight
size: smallMenu.buttonSize
onClicked: {
formStack.push(settingsForm)
@ -135,8 +128,7 @@ Page {
image: "qrc:/graphics/icons/logoutRed.png"
imageScale: 0.8
width: smallMenu.buttonWidth
height: smallMenu.buttonHeight
size: smallMenu.buttonSize
onClicked: {
logoutConfirmationDialog.open()