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

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
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;

View File

@ -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;
}

View File

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

View File

@ -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;
}

View File

@ -19,6 +19,7 @@
#ifndef UKUI_MENU_APP_MANAGER_H
#define UKUI_MENU_APP_MANAGER_H
#include <QObject>
#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