Skip to content

Commit

Permalink
fix: show single line when font is too large to show two lines
Browse files Browse the repository at this point in the history
字太大,显示不下两行的情况下,显示一行,并增加 tooltip。

Issue: linuxdeepin/developer-center#8239
Log:
  • Loading branch information
BLumia committed Apr 28, 2024
1 parent b1ce6d1 commit 92f52e5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions qml/IconItemDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,22 @@ Control {
}

Label {
property bool singleRow: isWindowedMode && (font.pixelSize > Helper.windowed.doubleRowMaxFontSize)
id: iconItemLabel
text: root.text
textFormat: Text.PlainText
width: parent.width
leftPadding: 2
rightPadding: 2
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
wrapMode: singleRow ? Text.NoWrap : Text.Wrap
elide: Text.ElideRight
maximumLineCount: 2
maximumLineCount: singleRow ? 1 : 2
}
}
ToolTip.text: root.text
ToolTip.delay: 1000
ToolTip.visible: hovered
background: ButtonPanel {
button: parent
outsideBorderColor: null
Expand Down

0 comments on commit 92f52e5

Please sign in to comment.