From e05af2b1f316201885c5c46ca11dcea9ebe7739f Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 6 Jun 2023 09:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=80=E8=BF=91=E5=8C=BA?= =?UTF-8?q?=E5=9F=9Ftooltip=E6=98=BE=E7=A4=BA=E8=B7=AF=E5=BE=84=E5=92=8C?= =?UTF-8?q?=E7=9C=81=E7=95=A5=E6=97=B6=E7=9A=84=E5=85=A8=E9=83=A8=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../recent-file/qml/RecentFileExtension.qml | 30 +++++++++++++++++++ .../recent-file/recent-file-extension.cpp | 6 ++++ qml/AppControls2/AppItem.qml | 1 + qml/AppControls2/FolderItem.qml | 1 + qml/AppControls2/LabelItem.qml | 1 + qml/AppUI/AppPageHeader.qml | 1 + qml/AppUI/FullScreenContent.qml | 3 ++ qml/AppUI/FullScreenFooter.qml | 1 + qml/AppUI/FullScreenHeader.qml | 1 + qml/AppUI/PluginSelectMenu.qml | 2 ++ qml/AppUI/SearchInputBar.qml | 2 +- qml/AppUI/Sidebar.qml | 2 ++ qml/extensions/FavoriteExtension.qml | 1 + 13 files changed, 51 insertions(+), 1 deletion(-) diff --git a/extension/recent-file/qml/RecentFileExtension.qml b/extension/recent-file/qml/RecentFileExtension.qml index 32a0251..786aa89 100644 --- a/extension/recent-file/qml/RecentFileExtension.qml +++ b/extension/recent-file/qml/RecentFileExtension.qml @@ -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 diff --git a/extension/recent-file/recent-file-extension.cpp b/extension/recent-file/recent-file-extension.cpp index 7f6bd89..f319da7 100644 --- a/extension/recent-file/recent-file-extension.cpp +++ b/extension/recent-file/recent-file-extension.cpp @@ -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 RecentFilesModel::roleNames() const names.insert(UriRole, "uri"); names.insert(NameRole, "name"); names.insert(IconRole, "icon"); + names.insert(PathRole, "path"); return names; } diff --git a/qml/AppControls2/AppItem.qml b/qml/AppControls2/AppItem.qml index 7eadc34..2d7207c 100644 --- a/qml/AppControls2/AppItem.qml +++ b/qml/AppControls2/AppItem.qml @@ -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 diff --git a/qml/AppControls2/FolderItem.qml b/qml/AppControls2/FolderItem.qml index 01523a5..45b2d34 100644 --- a/qml/AppControls2/FolderItem.qml +++ b/qml/AppControls2/FolderItem.qml @@ -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 { diff --git a/qml/AppControls2/LabelItem.qml b/qml/AppControls2/LabelItem.qml index 0bd7d5c..227f4d6 100644 --- a/qml/AppControls2/LabelItem.qml +++ b/qml/AppControls2/LabelItem.qml @@ -7,6 +7,7 @@ MouseArea { hoverEnabled: true ToolTip.text: comment ToolTip.visible: control.containsMouse + ToolTip.delay: 500 states: State { when: control.activeFocus PropertyChanges { diff --git a/qml/AppUI/AppPageHeader.qml b/qml/AppUI/AppPageHeader.qml index ad2dda4..f47bc41 100644 --- a/qml/AppUI/AppPageHeader.qml +++ b/qml/AppUI/AppPageHeader.qml @@ -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"; diff --git a/qml/AppUI/FullScreenContent.qml b/qml/AppUI/FullScreenContent.qml index 980a4c4..3edaa72 100644 --- a/qml/AppUI/FullScreenContent.qml +++ b/qml/AppUI/FullScreenContent.qml @@ -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 } diff --git a/qml/AppUI/FullScreenFooter.qml b/qml/AppUI/FullScreenFooter.qml index 0e91eee..6cc039c 100644 --- a/qml/AppUI/FullScreenFooter.qml +++ b/qml/AppUI/FullScreenFooter.qml @@ -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 diff --git a/qml/AppUI/FullScreenHeader.qml b/qml/AppUI/FullScreenHeader.qml index 9cd82e2..242cf82 100644 --- a/qml/AppUI/FullScreenHeader.qml +++ b/qml/AppUI/FullScreenHeader.qml @@ -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() diff --git a/qml/AppUI/PluginSelectMenu.qml b/qml/AppUI/PluginSelectMenu.qml index cd3628d..37abe1e 100644 --- a/qml/AppUI/PluginSelectMenu.qml +++ b/qml/AppUI/PluginSelectMenu.qml @@ -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 diff --git a/qml/AppUI/SearchInputBar.qml b/qml/AppUI/SearchInputBar.qml index 9415cef..28ccb1e 100644 --- a/qml/AppUI/SearchInputBar.qml +++ b/qml/AppUI/SearchInputBar.qml @@ -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 diff --git a/qml/AppUI/Sidebar.qml b/qml/AppUI/Sidebar.qml index 54ea1f0..cd9212e 100644 --- a/qml/AppUI/Sidebar.qml +++ b/qml/AppUI/Sidebar.qml @@ -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 diff --git a/qml/extensions/FavoriteExtension.qml b/qml/extensions/FavoriteExtension.qml index 59dc316..0b56e5d 100644 --- a/qml/extensions/FavoriteExtension.qml +++ b/qml/extensions/FavoriteExtension.qml @@ -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 }