Workspace: use font metrics for vertical centering
Another attempt xD
This commit is contained in:
parent
fc71f61000
commit
fabdf67da7
1 changed files with 5 additions and 2 deletions
|
|
@ -156,14 +156,17 @@ Item {
|
||||||
width: root.calculatedWsWidth(model)
|
width: root.calculatedWsWidth(model)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: workspacePill
|
id: pill
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
anchors.centerIn: parent
|
|
||||||
active: Settings.data.bar.showWorkspacesNames
|
active: Settings.data.bar.showWorkspacesNames
|
||||||
sourceComponent: Component {
|
sourceComponent: Component {
|
||||||
Text {
|
Text {
|
||||||
|
// Center horizontally
|
||||||
|
x: (pill.width - width) / 2
|
||||||
|
// Center vertically accounting for font metrics
|
||||||
|
y: (pill.height - height) / 2 + (height - contentHeight) / 2
|
||||||
text: {
|
text: {
|
||||||
if (model.name && model.name.length > 0) {
|
if (model.name && model.name.length > 0) {
|
||||||
return model.name.substring(0, 2)
|
return model.name.substring(0, 2)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue