添加最近区域tooltip显示路径和省略时的全部名称
This commit is contained in:
parent
373cd3ce44
commit
e05af2b1f3
|
@ -101,6 +101,7 @@ UkuiMenuExtension {
|
|||
}
|
||||
|
||||
AppControls2.StyleText {
|
||||
id: fileText
|
||||
width: parent.width - x
|
||||
height: 20
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
@ -109,6 +110,35 @@ UkuiMenuExtension {
|
|||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
ToolTip {
|
||||
visible: itemArea.containsMouse
|
||||
delay: 500
|
||||
contentItem: Column {
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
Text {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
visible: fileText.truncated
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: model.name
|
||||
Component.onCompleted: {
|
||||
if (contentWidth > recentFileView.width) {
|
||||
width = recentFileView.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("Path: ") + model.path
|
||||
Component.onCompleted: {
|
||||
if (contentWidth > recentFileView.width) {
|
||||
width = recentFileView.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: itemArea
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
UriRole = Qt::UserRole,
|
||||
NameRole = Qt::UserRole + 1,
|
||||
IconRole = Qt::UserRole + 2,
|
||||
PathRole = Qt::UserRole + 3
|
||||
};
|
||||
|
||||
explicit RecentFilesModel(QObject *parent = nullptr);
|
||||
|
@ -440,6 +441,10 @@ QVariant RecentFilesModel::data(const QModelIndex &index, int role) const
|
|||
return m_recentFileData.at(row).name;
|
||||
case IconRole:
|
||||
return m_recentFileData.at(row).icon;
|
||||
case PathRole: {
|
||||
QUrl baseUrl(m_recentFileData.at(row).uri);
|
||||
return baseUrl.adjusted(QUrl::RemoveFilename).path();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -453,6 +458,7 @@ QHash<int, QByteArray> RecentFilesModel::roleNames() const
|
|||
names.insert(UriRole, "uri");
|
||||
names.insert(NameRole, "name");
|
||||
names.insert(IconRole, "icon");
|
||||
names.insert(PathRole, "path");
|
||||
return names;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ MouseArea {
|
|||
alpha: isSelect ? 1.00 : control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
|
||||
ToolTip.visible: content.textTruncated && control.containsMouse
|
||||
ToolTip.text: name
|
||||
ToolTip.delay: 500
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -12,6 +12,7 @@ MouseArea {
|
|||
hoverEnabled: true
|
||||
ToolTip.visible: !editStatus && truncate && control.containsMouse
|
||||
ToolTip.text: name
|
||||
ToolTip.delay: 500
|
||||
states: State {
|
||||
when: control.activeFocus
|
||||
PropertyChanges {
|
||||
|
|
|
@ -7,6 +7,7 @@ MouseArea {
|
|||
hoverEnabled: true
|
||||
ToolTip.text: comment
|
||||
ToolTip.visible: control.containsMouse
|
||||
ToolTip.delay: 500
|
||||
states: State {
|
||||
when: control.activeFocus
|
||||
PropertyChanges {
|
||||
|
|
|
@ -200,6 +200,7 @@ Item {
|
|||
height: ListView.view ? ListView.view.height : 0
|
||||
buttonIcon: model.icon
|
||||
ToolTip.text: qsTr("Search App")
|
||||
ToolTip.delay: 500
|
||||
ToolTip.visible: containsMouse
|
||||
onClicked: {
|
||||
root.state = "search";
|
||||
|
|
|
@ -224,6 +224,7 @@ RowLayout {
|
|||
hoverEnabled: true
|
||||
width: 170; height: width
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: name
|
||||
ToolTip.visible: iconText.truncated && containsMouse
|
||||
AppControls2.StyleBackground {
|
||||
|
@ -324,6 +325,7 @@ RowLayout {
|
|||
hoverEnabled: true
|
||||
width: 170; height: width
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: name
|
||||
ToolTip.visible: folderText.truncated && containsMouse
|
||||
AppControls2.StyleBackground {
|
||||
|
@ -487,6 +489,7 @@ RowLayout {
|
|||
appIcon: modelData.icon
|
||||
spacing: 8
|
||||
textHighLight: true
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: modelData.name
|
||||
ToolTip.visible: textTruncated && labelAppsMouseArea.containsMouse
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ Row {
|
|||
id: powerButtonArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
ToolTip.delay: 500
|
||||
ToolTip.visible: containsMouse
|
||||
ToolTip.text: powerButtonBase.toolTip
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
|
|
@ -59,6 +59,7 @@ Item {
|
|||
id: buttonMouseArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: qsTr("Contract")
|
||||
ToolTip.visible: containsMouse
|
||||
onClicked: mainWindow.exitFullScreen()
|
||||
|
|
|
@ -40,6 +40,7 @@ RowLayout {
|
|||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: height
|
||||
activeFocusOnTab: true
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: qsTr("Switch Sort Type")
|
||||
ToolTip.visible: containsMouse
|
||||
|
||||
|
@ -64,6 +65,7 @@ RowLayout {
|
|||
Layout.fillHeight: true
|
||||
Layout.maximumWidth: 16
|
||||
Layout.maximumHeight: 16
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: qsTr("Sort Type Options")
|
||||
ToolTip.visible: containsMouse
|
||||
hoverEnabled: true
|
||||
|
|
|
@ -106,8 +106,8 @@ AppControls2.StyleBackground {
|
|||
appPage.content.resetFocus();
|
||||
}
|
||||
}
|
||||
onEditingFinished: changeFocusToListView()
|
||||
Keys.onDownPressed: changeFocusToListView()
|
||||
Keys.onReturnPressed: changeFocusToListView()
|
||||
|
||||
//字体选中跟随主题高亮
|
||||
property int textColor: mainWindow.isFullScreen ? Palette.HighlightedText : Palette.Text
|
||||
|
|
|
@ -76,6 +76,7 @@ Item {
|
|||
id: buttonMouseArea
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
ToolTip.delay: 500
|
||||
ToolTip.text: qsTr("Expand")
|
||||
ToolTip.visible: containsMouse
|
||||
|
||||
|
@ -138,6 +139,7 @@ Item {
|
|||
id: powerButtonArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
ToolTip.delay: 500
|
||||
ToolTip.visible: containsMouse
|
||||
ToolTip.text: powerButtonBase.toolTip
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
|
|
@ -143,6 +143,7 @@ UkuiMenuExtension {
|
|||
scale: (control.containsPress && !icon.hold) ? 1.1 : 1.0
|
||||
ToolTip.visible: textTruncated && control.containsMouse
|
||||
ToolTip.text: model.name
|
||||
ToolTip.delay: 500
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation { duration: 300; easing.type: Easing.InOutCubic }
|
||||
|
|
Loading…
Reference in New Issue