Vertically center tooltip icon/image

Summary:
Right now the widget tooltip's icon/image is top-aligned, which in practice makes it
vertically centered when the tooltip has only one line of text, but not vertically
centered when there are two lines of text.

This patch makes it vertally centered all the time, improving the appearance.

Test Plan:
Before: {F8095695}

After: {F8095696}

{F8095697}

Reviewers: #vdg, #plasma, filipf, ndavis

Reviewed By: #vdg, filipf, ndavis

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27299
This commit is contained in:
Nate Graham 2020-02-10 10:55:26 -07:00
parent 2b78afd921
commit 9d27675c3b

View File

@ -54,14 +54,14 @@ PlasmaCore.ColorScope {
id: tooltipImage
source: toolTip ? toolTip.image : ""
visible: toolTip != null && toolTip.image != ""
Layout.alignment: Qt.AlignTop
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
}
PlasmaCore.IconItem {
id: tooltipIcon
animated: false
source: toolTip ? toolTip.icon : ""
Layout.alignment: Qt.AlignTop
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
visible: toolTip != null && toolTip.icon != "" && toolTip.image == "" && valid
Layout.preferredWidth: units.iconSizes.medium
Layout.preferredHeight: units.iconSizes.medium