make sure the size hints are integer and even
Summary: for retrocompatibility with pc2 units.gridUnit * 1.6 is used a lot as size hint (we have to guarantee buttons and textfields have the same height by default for perfect horizontal alignment. tough we have make sure that size is integer and even otherwise we'll have a lot of internal misalignments Reviewers: broulik Reviewed By: broulik Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27399
This commit is contained in:
parent
3de1c2462e
commit
667dce502a
@ -46,8 +46,7 @@ T.Button {
|
|||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
Layout.fillWidth: control.icon.width <= 0
|
Layout.alignment: Qt.AlignCenter
|
||||||
Layout.fillHeight: control.icon.height <= 0
|
|
||||||
Layout.preferredWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.small
|
Layout.preferredWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.small
|
||||||
Layout.preferredHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.small
|
Layout.preferredHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.small
|
||||||
|
|
||||||
@ -72,7 +71,8 @@ T.Button {
|
|||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
//retrocompatibility with old controls
|
//retrocompatibility with old controls
|
||||||
implicitHeight: units.gridUnit * 1.6
|
implicitWidth: Math.floor(units.gridUnit * 1.6) + Math.floor(units.gridUnit * 1.6) % 2
|
||||||
|
implicitHeight: implicitWidth
|
||||||
Private.ButtonShadow {
|
Private.ButtonShadow {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: (!control.flat || control.hovered) && (!control.pressed || !control.checked)
|
visible: (!control.flat || control.hovered) && (!control.pressed || !control.checked)
|
||||||
|
@ -45,8 +45,7 @@ T.TabButton {
|
|||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
Layout.fillWidth: control.icon.width <= 0
|
Layout.alignment: Qt.AlignCenter
|
||||||
Layout.fillHeight: control.icon.height <= 0
|
|
||||||
Layout.preferredWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
|
Layout.preferredWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
|
||||||
Layout.preferredHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
|
Layout.preferredHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ T.TextField {
|
|||||||
implicitWidth: Math.max(units.gridUnit * 8,
|
implicitWidth: Math.max(units.gridUnit * 8,
|
||||||
placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
|
placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
|
||||||
|| contentWidth + leftPadding + rightPadding
|
|| contentWidth + leftPadding + rightPadding
|
||||||
implicitHeight: units.gridUnit * 1.6
|
implicitHeight: Math.floor(units.gridUnit * 1.6) + Math.floor(units.gridUnit * 1.6) % 2
|
||||||
|
|
||||||
padding: 6
|
padding: 6
|
||||||
|
|
||||||
|
@ -50,8 +50,7 @@ T.ToolButton {
|
|||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
Layout.fillWidth: control.icon.width <= 0
|
Layout.alignment: Qt.AlignCenter
|
||||||
Layout.fillHeight: control.icon.height <= 0
|
|
||||||
Layout.preferredWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
|
Layout.preferredWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
|
||||||
Layout.preferredHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
|
Layout.preferredHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
|
||||||
|
|
||||||
@ -60,12 +59,7 @@ T.ToolButton {
|
|||||||
source: control.icon ? (control.icon.name || control.icon.source) : ""
|
source: control.icon ? (control.icon.name || control.icon.source) : ""
|
||||||
status: control.activeFocus && !control.pressed && !control.checked ? PlasmaCore.Svg.Selected : PlasmaCore.Svg.Normal
|
status: control.activeFocus && !control.pressed && !control.checked ? PlasmaCore.Svg.Selected : PlasmaCore.Svg.Normal
|
||||||
}
|
}
|
||||||
PlasmaCore.FrameSvgItem {
|
|
||||||
id: buttonsurfaceChecker
|
|
||||||
visible: false
|
|
||||||
imagePath: "widgets/button"
|
|
||||||
prefix: control.flat ? ["toolbutton-hover", "normal"] : "normal"
|
|
||||||
}
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
@ -76,13 +70,20 @@ T.ToolButton {
|
|||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
||||||
|
PlasmaCore.FrameSvgItem {
|
||||||
|
id: buttonsurfaceChecker
|
||||||
|
visible: false
|
||||||
|
imagePath: "widgets/button"
|
||||||
|
prefix: control.flat ? ["toolbutton-hover", "normal"] : "normal"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {
|
background: Item {
|
||||||
//retrocompatibility with old controls
|
//retrocompatibility with old controls
|
||||||
implicitWidth: units.gridUnit * 1.6
|
implicitWidth: Math.floor(units.gridUnit * 1.6) + Math.floor(units.gridUnit * 1.6) % 2
|
||||||
implicitHeight: units.gridUnit * 1.6
|
implicitHeight: implicitWidth
|
||||||
Private.ButtonShadow {
|
Private.ButtonShadow {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: (!control.flat || control.hovered) && (!control.pressed || !control.checked)
|
visible: (!control.flat || control.hovered) && (!control.pressed || !control.checked)
|
||||||
|
Loading…
Reference in New Issue
Block a user