Fix alignment of the ApplicationSwitcher button

The sign in button has a different size when you are logged in, where the account avatar was being drawn in the middle of the Sign In button. This was causing a weird alignment of the ApplicationSwitcher next to it, as it was adding an extra margin.

This is now fixed by making sure that the width of the button that has to do with account adjusts according to whether you are logged in or not. This makes the ApplicationSwitcher icon move when you log in but looks more natural relatively to the account button.

CURA-8421
This commit is contained in:
Konstantinos Karmas 2021-09-20 16:57:16 +02:00
parent a9968acd6d
commit d844c5f70a
2 changed files with 5 additions and 5 deletions

View file

@ -12,8 +12,8 @@ Item
property var profile: Cura.API.account.userProfile property var profile: Cura.API.account.userProfile
property var loggedIn: Cura.API.account.isLoggedIn property var loggedIn: Cura.API.account.isLoggedIn
height: signInButton.height > accountWidget.height ? signInButton.height : accountWidget.height height: signInButton.visible ? signInButton.height : accountWidget.height
width: signInButton.width > accountWidget.width ? signInButton.width : accountWidget.width width: signInButton.visible ? signInButton.width : accountWidget.width
Button Button
{ {
@ -54,7 +54,7 @@ Item
id: accountWidget id: accountWidget
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: signInButton.horizontalCenter // anchors.horizontalCenter: signInButton.horizontalCenter
implicitHeight: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) implicitHeight: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
implicitWidth: Math.round(0.5 * UM.Theme.getSize("main_window_header").height) implicitWidth: Math.round(0.5 * UM.Theme.getSize("main_window_header").height)
@ -142,7 +142,7 @@ Item
borderColor: UM.Theme.getColor("lining") borderColor: UM.Theme.getColor("lining")
borderWidth: UM.Theme.getSize("default_lining").width borderWidth: UM.Theme.getSize("default_lining").width
target: Qt.point(width - (signInButton.width / 2), -10) target: Qt.point(width - ((signInButton.visible ? signInButton.width : accountWidget.width) / 2), -10)
arrowSize: UM.Theme.getSize("default_arrow").width arrowSize: UM.Theme.getSize("default_arrow").width
} }

View file

@ -146,7 +146,7 @@ Item
{ {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: accountWidget.left right: accountWidget.left
// rightMargin: UM.Theme.getSize("default_margin").width rightMargin: UM.Theme.getSize("default_margin").width
} }
} }