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