Commit 00369ec4 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Window/Desktop Switchers] Use PlasmaComponents.Label instead of Text

The former uses native text rendering which respects anti-aliasing and hinting settings.
It also automatically follows theme colors.
Unfortunately it breaks the font.bold binding, so using font.weight here instead.

BUG: 372218
FIXED-IN: 5.8.4

CHANGELOG: Font rendering in window/desktop switchers now follows anti-aliasing and hinting settings

Differential Revision: https://phabricator.kde.org/D3330
parent 02ebdb54
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -116,7 +117,7 @@ KWin.Switcher {
bottom: parent.bottom
topMargin: hoverItem.margins.bottom
}
Text {
PlasmaComponents.Label {
function constrainWidth() {
if (textItem.width > textItem.maxWidth && textItem.width > 0 && textItem.maxWidth > 0) {
textItem.width = textItem.maxWidth;
......@@ -132,11 +133,8 @@ KWin.Switcher {
text: listView.currentItem ? listView.currentItem.caption : ""
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: theme.textColor
elide: Text.ElideMiddle
font {
bold: true
}
font.weight: Font.Bold
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
......
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -66,7 +67,7 @@ KWin.Switcher {
right: parent.right
bottom: parent.bottom
}
Text {
PlasmaComponents.Label {
function constrainWidth() {
if (textItem.width > textItem.maxWidth && textItem.width > 0 && textItem.maxWidth > 0) {
textItem.width = textItem.maxWidth;
......@@ -82,11 +83,8 @@ KWin.Switcher {
text: icons.currentItem ? icons.currentItem.caption : ""
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: theme.textColor
elide: Text.ElideMiddle
font {
bold: true
}
font.weight: Font.Bold
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
......
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -87,13 +88,12 @@ KWin.Switcher {
leftMargin: hoverItem.margins.left
}
}
Text {
PlasmaComponents.Label {
id: captionItem
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignBottom
text: dialogMainItem.itemCaption(caption, minimized)
font.bold: index == compactListView.currentIndex
color: theme.textColor
font.weight: index === compactListView.currentIndex ? Font.Bold : Font.Normal
elide: Text.ElideMiddle
anchors {
left: iconItem.right
......
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -74,13 +75,12 @@ KWin.Switcher {
leftMargin: hoverItem.margins.left
}
}
Text {
PlasmaComponents.Label {
id: captionItem
horizontalAlignment: Text.AlignHCenter
text: listView.itemCaption(caption, minimized)
font.bold: true
font.weight: Font.Bold
font.italic: minimized
color: theme.textColor
elide: Text.ElideMiddle
anchors {
left: iconItem.right
......@@ -90,13 +90,11 @@ KWin.Switcher {
rightMargin: hoverItem.margins.right
}
}
Text {
PlasmaComponents.Label {
id: desktopNameItem
horizontalAlignment: Text.AlignHCenter
text: desktopName
font.bold: false
font.italic: true
color: theme.textColor
elide: Text.ElideMiddle
visible: tabBox.allDesktops
anchors {
......
......@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -105,11 +106,10 @@ KWin.Switcher {
Layout.preferredWidth: iconSize
Layout.preferredHeight: iconSize
}
Text {
PlasmaComponents.Label {
text: caption
font.italic: minimized
font.bold: index == thumbnailListView.currentIndex
color: theme.textColor
font.weight: index === thumbnailListView.currentIndex ? Font.Bold : Font.Normal
elide: Text.ElideMiddle
Layout.fillWidth: true
Layout.maximumWidth: captionItem.maximumWidth - iconItem.iconSize - captionItem.spacing * 2
......
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -65,17 +66,14 @@ KWin.Switcher {
right: parent.right
bottom: parent.bottom
}
Text {
PlasmaComponents.Label {
id: textItem
text: icons.currentItem ? icons.currentItem.caption : ""
height: paintedHeight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: theme.textColor
elide: Text.ElideMiddle
font {
bold: true
}
font.weight: Font.Bold
anchors {
right: parent.right
left: parent.left
......
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -61,11 +62,10 @@ KWin.Switcher {
id: delegateItem
width: textListView.width
height: textListView.rowHeight
Text {
PlasmaComponents.Label {
id: captionItem
horizontalAlignment: Text.AlignHCenter
text: caption
color: theme.textColor
elide: Text.ElideMiddle
anchors {
left: parent.left
......
......@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kwin 2.0 as KWin
......@@ -133,7 +134,7 @@ KWin.Switcher {
rightMargin: 4
}
}
Text {
PlasmaComponents.Label {
function constrainWidth() {
if (textItem.width > textItem.maxWidth && textItem.width > 0 && textItem.maxWidth > 0) {
textItem.width = textItem.maxWidth;
......@@ -149,11 +150,8 @@ KWin.Switcher {
text: thumbnailListView.currentItem ? thumbnailListView.currentItem.caption : ""
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: theme.textColor
elide: Text.ElideMiddle
font {
bold: true
}
font.weight: Font.Bold
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment