[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
This commit is contained in:
parent
951dfd1036
commit
fe07909cd8
1 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue