Commit fe07909c authored by David Edmundson's avatar David Edmundson

[desktopchangeosd] Sync desktop switch OSD font size to Plasma OSD font size

Summary:
Plasma's OSDs for volume/screens etc use PlasmaExtras.Heading, this
should to.

Also correct centering text to constrain the text element and align the
text within that bounding box. Previous code could have overflown in the
event of a really really long desktop name if we're resizing to the
grid.

BUG: 356600

Test Plan:
Switched desktop with OSD on
Tried with and without "show desktop layout indicators"

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16420
parent 951dfd10
......@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0;
import QtQuick.Window 2.0;
import org.kde.plasma.core 2.0 as PlasmaCore;
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.components 2.0 as Plasma;
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons;
import org.kde.kwin 2.0;
......@@ -75,15 +76,20 @@ PlasmaCore.Dialog {
property int animationDuration: 1000
property bool showGrid: true
width: dialogItem.showGrid ? view.itemWidth * view.columns : textElement.width
width: dialogItem.showGrid ? view.itemWidth * view.columns : Math.ceil(textElement.implicitWidth)
height: dialogItem.showGrid ? view.itemHeight * view.rows + textElement.height : textElement.height
Plasma.Label {
PlasmaExtras.Heading {
id: textElement
anchors.top: dialogItem.showGrid ? parent.top : undefined
anchors.horizontalCenter: parent.horizontalCenter
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.NoWrap
elide: Text.ElideRight
text: workspace.desktopName(workspace.currentDesktop)
}
Grid {
id: view
columns: 1
......
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