添加界面ToolTip

This commit is contained in:
qiqi 2023-06-02 15:44:16 +08:00 committed by He Sir
parent 9290c71214
commit ce4f761a3c
10 changed files with 30 additions and 7 deletions

View File

@ -5,7 +5,7 @@ import QtQuick.Controls 2.5
MouseArea { MouseArea {
id: control id: control
hoverEnabled: true hoverEnabled: true
ToolTip.text: qsTr("Open the label selection interface") ToolTip.text: comment
ToolTip.visible: control.containsMouse ToolTip.visible: control.containsMouse
states: State { states: State {
when: control.activeFocus when: control.activeFocus

View File

@ -64,6 +64,7 @@ Item {
property string id: model.id property string id: model.id
property string name: model.name property string name: model.name
property string icon: model.icon property string icon: model.icon
property string comment: model.comment // label tooltip
property int toTop: model.top property int toTop: model.top
property bool recentInstall: model.recentInstall property bool recentInstall: model.recentInstall
sourceComponent: { sourceComponent: {

View File

@ -196,8 +196,11 @@ Item {
model: appPageHeaderUtils.model(PluginGroup.Button) model: appPageHeaderUtils.model(PluginGroup.Button)
delegate: AppControls2.RoundButton { delegate: AppControls2.RoundButton {
width: height; height: ListView.view ? ListView.view.height : 0 width: height
height: ListView.view ? ListView.view.height : 0
buttonIcon: model.icon buttonIcon: model.icon
ToolTip.text: qsTr("Search App")
ToolTip.visible: containsMouse
onClicked: { onClicked: {
root.state = "search"; root.state = "search";
// model // model

View File

@ -224,7 +224,8 @@ RowLayout {
hoverEnabled: true hoverEnabled: true
width: 170; height: width width: 170; height: width
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
ToolTip.text: name
ToolTip.visible: iconText.truncated && containsMouse
AppControls2.StyleBackground { AppControls2.StyleBackground {
anchors.fill: parent anchors.fill: parent
useStyleTransparent: false useStyleTransparent: false
@ -323,7 +324,8 @@ RowLayout {
hoverEnabled: true hoverEnabled: true
width: 170; height: width width: 170; height: width
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
ToolTip.text: name
ToolTip.visible: folderText.truncated && containsMouse
AppControls2.StyleBackground { AppControls2.StyleBackground {
anchors.fill: parent anchors.fill: parent
useStyleTransparent: false useStyleTransparent: false
@ -350,8 +352,8 @@ RowLayout {
AppControls2.FolderIcon { AppControls2.FolderIcon {
id: folderIcon id: folderIcon
width: 96 width: 86
height: 96 height: 86
rows: 4; columns: 4 rows: 4; columns: 4
spacing: 2; padding: 8 spacing: 2; padding: 8
icons: icon icons: icon
@ -361,6 +363,7 @@ RowLayout {
} }
AppControls2.StyleText { AppControls2.StyleText {
id: folderText
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 20 anchors.bottomMargin: 20
width: parent.width width: parent.width
@ -465,6 +468,7 @@ RowLayout {
height: GridView.view.cellHeight height: GridView.view.cellHeight
MouseArea { MouseArea {
id: labelAppsMouseArea
anchors.centerIn: parent anchors.centerIn: parent
hoverEnabled: true hoverEnabled: true
width: 170; height: width width: 170; height: width
@ -483,6 +487,8 @@ RowLayout {
appIcon: modelData.icon appIcon: modelData.icon
spacing: 8 spacing: 8
textHighLight: true textHighLight: true
ToolTip.text: modelData.name
ToolTip.visible: textTruncated && labelAppsMouseArea.containsMouse
} }
} }

View File

@ -59,6 +59,8 @@ Item {
id: buttonMouseArea id: buttonMouseArea
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
ToolTip.text: qsTr("Contract")
ToolTip.visible: containsMouse
onClicked: mainWindow.exitFullScreen() onClicked: mainWindow.exitFullScreen()
activeFocusOnTab: true activeFocusOnTab: true
Keys.onPressed: { Keys.onPressed: {

View File

@ -40,6 +40,8 @@ RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumWidth: height Layout.maximumWidth: height
activeFocusOnTab: true activeFocusOnTab: true
ToolTip.text: qsTr("Switch Sort Type")
ToolTip.visible: containsMouse
highlight: mainWindow.isFullScreen highlight: mainWindow.isFullScreen
autoHighLight: !mainWindow.isFullScreen autoHighLight: !mainWindow.isFullScreen
@ -62,6 +64,9 @@ RowLayout {
Layout.fillHeight: true Layout.fillHeight: true
Layout.maximumWidth: 16 Layout.maximumWidth: 16
Layout.maximumHeight: 16 Layout.maximumHeight: 16
ToolTip.text: qsTr("Sort Type Options")
ToolTip.visible: containsMouse
hoverEnabled: true
activeFocusOnTab: true activeFocusOnTab: true
Keys.onPressed: { Keys.onPressed: {

View File

@ -76,6 +76,9 @@ Item {
id: buttonMouseArea id: buttonMouseArea
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
ToolTip.text: qsTr("Expand")
ToolTip.visible: containsMouse
onClicked: mainWindow.isFullScreen = true onClicked: mainWindow.isFullScreen = true
activeFocusOnTab: true activeFocusOnTab: true
Keys.onPressed: { Keys.onPressed: {

View File

@ -141,6 +141,8 @@ UkuiMenuExtension {
appIcon: model.icon appIcon: model.icon
display: Display.TextUnderIcon display: Display.TextUnderIcon
scale: (control.containsPress && !icon.hold) ? 1.1 : 1.0 scale: (control.containsPress && !icon.hold) ? 1.1 : 1.0
ToolTip.visible: textTruncated && control.containsMouse
ToolTip.text: model.name
Behavior on scale { Behavior on scale {
NumberAnimation { duration: 300; easing.type: Easing.InOutCubic } NumberAnimation { duration: 300; easing.type: Easing.InOutCubic }

View File

@ -201,6 +201,7 @@ void AppCategoryPlugin::generateData(QVector<DataEntity> &data)
} }
DataEntity label; DataEntity label;
label.setComment(tr("Open Function Sort Menu"));
label.setType(DataType::Label); label.setType(DataType::Label);
label.setId(item.label.id()); label.setId(item.label.id());
label.setName(item.label.displayName()); label.setName(item.label.displayName());

View File

@ -162,7 +162,7 @@ void AppLetterSortPlugin::addAppToLabel(const QString &labelName, QVector<DataEn
if (!apps.isEmpty()) { if (!apps.isEmpty()) {
DataEntity dataEntity; DataEntity dataEntity;
dataEntity.setComment(tr("Letter sort button")); dataEntity.setComment(tr("Open Letter Sort Menu"));
dataEntity.setName(labelName); dataEntity.setName(labelName);
dataEntity.setId(labelName); dataEntity.setId(labelName);
dataEntity.setType(DataType::Label); dataEntity.setType(DataType::Label);