diff --git a/qml/extensions/FavoriteExtension.qml b/qml/extensions/FavoriteExtension.qml index cf6564f..4680ac8 100644 --- a/qml/extensions/FavoriteExtension.qml +++ b/qml/extensions/FavoriteExtension.qml @@ -71,7 +71,9 @@ UkuiMenuExtension { id: delegateRoot property int visualIndex: DelegateModel.itemsIndex width: favoriteView.cellWidth; height: favoriteView.cellHeight - onEntered: visualModel.items.move(drag.source.visualIndex, icon.visualIndex) + onEntered: { + visualModel.items.move(drag.source.visualIndex, icon.visualIndex) + } Binding { target: icon; property: "visualIndex"; value: visualIndex } @@ -112,11 +114,6 @@ UkuiMenuExtension { pressAndHoldInterval: 300 acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: { - if (mouse.button === Qt.RightButton) { - console.log("RightButtononPressed:",mouse.x,mouse.y); - } - } onClicked: { if (mouse.button === Qt.RightButton) { visualModel.model.openMenu(index) @@ -161,8 +158,20 @@ UkuiMenuExtension { } ParallelAnimation { id: iconResetAnimation - NumberAnimation { target: icon; property: "x"; to: delegateRoot.x; easing.type: Easing.OutQuad; duration: 300 } - NumberAnimation { target: icon; property: "y"; to: delegateRoot.y; easing.type: Easing.OutQuad; duration: 300 } + NumberAnimation { + target: icon + property: "x" + to: delegateRoot.x + easing.type: Easing.OutQuad + duration: 300 + } + NumberAnimation { + target: icon + property: "y" + to: delegateRoot.y - favoriteView.contentY + easing.type: Easing.OutQuad + duration: 300 + } onFinished: { icon.parent = delegateRoot; diff --git a/src/ukui-menu-application.cpp b/src/ukui-menu-application.cpp index d8f6d89..e1009a0 100644 --- a/src/ukui-menu-application.cpp +++ b/src/ukui-menu-application.cpp @@ -103,6 +103,8 @@ void UkuiMenuApplication::initQmlEngine() // }, Qt::QueuedConnection); // // m_applicationEngine->load(url); + + connect(AppManager::instance(), &AppManager::request, this, &UkuiMenuApplication::execCommand); } void UkuiMenuApplication::loadMenuUI() @@ -148,6 +150,12 @@ void UkuiMenuApplication::execCommand(Command command) QCoreApplication::quit(); break; } + case Hide: { + if (m_mainWindow) { + m_mainWindow->setVisible(false); + } + break; + } default: break; } diff --git a/src/ukui-menu-application.h b/src/ukui-menu-application.h index da1d71e..2b419f0 100644 --- a/src/ukui-menu-application.h +++ b/src/ukui-menu-application.h @@ -37,7 +37,8 @@ public: enum Command { Active = 0, Show, - Quit + Quit, + Hide }; explicit UkuiMenuApplication(MenuMessageProcessor *processor); ~UkuiMenuApplication() override; diff --git a/src/utils/app-manager.cpp b/src/utils/app-manager.cpp index 147fd60..72502fc 100644 --- a/src/utils/app-manager.cpp +++ b/src/utils/app-manager.cpp @@ -49,6 +49,7 @@ AppManager::AppManager(QObject *parent) : QObject(parent) bool AppManager::launchApp(const QString &desktopFilePath) { + Q_EMIT request(UkuiMenuApplication::Hide); if (launchAppWithDBus(desktopFilePath)) { return true; } diff --git a/src/utils/app-manager.h b/src/utils/app-manager.h index aa39852..7a26d85 100644 --- a/src/utils/app-manager.h +++ b/src/utils/app-manager.h @@ -19,6 +19,7 @@ #ifndef UKUI_MENU_APP_MANAGER_H #define UKUI_MENU_APP_MANAGER_H #include +#include "ukui-menu-application.h" class QDBusInterface; @@ -43,6 +44,9 @@ private: private: QDBusInterface *m_appManagerDbusInterface = nullptr; + +Q_SIGNALS: + void request(UkuiMenuApplication::Command command); }; } // UkuiMenu