修改收藏区域拖拽定位错误问题;添加打开应用开始菜单隐藏

This commit is contained in:
qiqi 2023-04-28 17:37:39 +08:00
parent 36f3413016
commit afdb9ddce9
5 changed files with 32 additions and 9 deletions

View File

@ -71,7 +71,9 @@ UkuiMenuExtension {
id: delegateRoot id: delegateRoot
property int visualIndex: DelegateModel.itemsIndex property int visualIndex: DelegateModel.itemsIndex
width: favoriteView.cellWidth; height: favoriteView.cellHeight 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 } Binding { target: icon; property: "visualIndex"; value: visualIndex }
@ -112,11 +114,6 @@ UkuiMenuExtension {
pressAndHoldInterval: 300 pressAndHoldInterval: 300
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onPressed: {
if (mouse.button === Qt.RightButton) {
console.log("RightButtononPressed:",mouse.x,mouse.y);
}
}
onClicked: { onClicked: {
if (mouse.button === Qt.RightButton) { if (mouse.button === Qt.RightButton) {
visualModel.model.openMenu(index) visualModel.model.openMenu(index)
@ -161,8 +158,20 @@ UkuiMenuExtension {
} }
ParallelAnimation { ParallelAnimation {
id: iconResetAnimation id: iconResetAnimation
NumberAnimation { target: icon; property: "x"; to: delegateRoot.x; easing.type: Easing.OutQuad; duration: 300 } NumberAnimation {
NumberAnimation { target: icon; property: "y"; to: delegateRoot.y; easing.type: Easing.OutQuad; duration: 300 } 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: { onFinished: {
icon.parent = delegateRoot; icon.parent = delegateRoot;

View File

@ -103,6 +103,8 @@ void UkuiMenuApplication::initQmlEngine()
// }, Qt::QueuedConnection); // }, Qt::QueuedConnection);
// //
// m_applicationEngine->load(url); // m_applicationEngine->load(url);
connect(AppManager::instance(), &AppManager::request, this, &UkuiMenuApplication::execCommand);
} }
void UkuiMenuApplication::loadMenuUI() void UkuiMenuApplication::loadMenuUI()
@ -148,6 +150,12 @@ void UkuiMenuApplication::execCommand(Command command)
QCoreApplication::quit(); QCoreApplication::quit();
break; break;
} }
case Hide: {
if (m_mainWindow) {
m_mainWindow->setVisible(false);
}
break;
}
default: default:
break; break;
} }

View File

@ -37,7 +37,8 @@ public:
enum Command { enum Command {
Active = 0, Active = 0,
Show, Show,
Quit Quit,
Hide
}; };
explicit UkuiMenuApplication(MenuMessageProcessor *processor); explicit UkuiMenuApplication(MenuMessageProcessor *processor);
~UkuiMenuApplication() override; ~UkuiMenuApplication() override;

View File

@ -49,6 +49,7 @@ AppManager::AppManager(QObject *parent) : QObject(parent)
bool AppManager::launchApp(const QString &desktopFilePath) bool AppManager::launchApp(const QString &desktopFilePath)
{ {
Q_EMIT request(UkuiMenuApplication::Hide);
if (launchAppWithDBus(desktopFilePath)) { if (launchAppWithDBus(desktopFilePath)) {
return true; return true;
} }

View File

@ -19,6 +19,7 @@
#ifndef UKUI_MENU_APP_MANAGER_H #ifndef UKUI_MENU_APP_MANAGER_H
#define UKUI_MENU_APP_MANAGER_H #define UKUI_MENU_APP_MANAGER_H
#include <QObject> #include <QObject>
#include "ukui-menu-application.h"
class QDBusInterface; class QDBusInterface;
@ -43,6 +44,9 @@ private:
private: private:
QDBusInterface *m_appManagerDbusInterface = nullptr; QDBusInterface *m_appManagerDbusInterface = nullptr;
Q_SIGNALS:
void request(UkuiMenuApplication::Command command);
}; };
} // UkuiMenu } // UkuiMenu