Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ FocusScope {
horizontalAlignment: Text.AlignLeft
wrapMode: Text.WordWrap
maximumLineCount: 2
displayTruncatedTextOnHover: true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
*/
import QtQuick

pragma ComponentBehavior: Bound

Text {
id: root

readonly property bool isEmpty: text.length === 0
property bool displayTruncatedTextOnHover: false

color: ui.theme.fontPrimaryColor
linkColor: ui.theme.linkColor
Expand All @@ -43,21 +46,27 @@ Text {
Qt.openUrlExternally(link)
}

onHoveredLinkChanged: {
if (Boolean(hoveredLink)) {
mouseAreaLoader.active = true
}
}

Loader {
id: mouseAreaLoader
anchors.fill: parent
active: false
active: (root.displayTruncatedTextOnHover && root.truncated) || root.hoveredLink

sourceComponent: MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape: root.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true

onPressed: {
ui.tooltip.hide(root, true)
}

onContainsMouseChanged: {
if (!containsMouse || !root.truncated || root.hoveredLink) {
ui.tooltip.hide(root)
return
}
ui.tooltip.show(root, root.text)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ StyledPopupView {
font: ui.theme.bodyBoldFont
horizontalAlignment: Text.AlignLeft
wrapMode: Text.WordWrap
maximumLineCount: 2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we could accommodate blank titles and use the description text instead...

}

StyledTextLabel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ FocusScope {
horizontalAlignment: Text.AlignLeft
wrapMode: Text.WordWrap
maximumLineCount: 2
displayTruncatedTextOnHover: true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Column {

wrapMode: Text.Wrap
maximumLineCount: 2
displayTruncatedTextOnHover: true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ StyledDialogView {

StyledTextLabel {
id: descriptionLabel
text: instrumentsPage.description

// DO NOT MERGE THIS:
text: "Hello world - this is an extremely long instrument description to simulate truncated labels and tooltips. This instrument has 13 strings, a hihat, a mouthpiece, and sounds terrible. Nobody should ever use this instrument. Lorem ipsum dolor etc, etc. End of text."
displayTruncatedTextOnHover: true

Layout.fillWidth: true
Layout.maximumHeight: buttonBox.height
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ Column {

text: button.text
font: ui.theme.bodyFont

Component.onCompleted: {
button.toolTipTitle = truncated ? button.text : ""
}

onTruncatedChanged: {
button.toolTipTitle = truncated ? button.text : ""
}
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/project/qml/MuseScore/Project/NewScoreDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ StyledDialogView {

StyledTextLabel {
id: descriptionLabel
text: pagesStack.currentIndex === 0
? chooseInstrumentsAndTemplatePage.description
: ""

// DO NOT MERGE THIS:
text: "Hello world - this is an extremely long instrument description to simulate truncated labels and tooltips. This instrument has 13 strings, a hihat, a mouthpiece, and sounds terrible. Nobody should ever use this instrument. Lorem ipsum dolor etc, etc. End of text."
displayTruncatedTextOnHover: true

Layout.fillWidth: true
Layout.maximumHeight: buttonBox.height
Expand Down
Loading