mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Revert "feat: 优化任务栏拖拽功能"
This reverts commit f95055e0b908e415b0dd7d463cc2e326bd0738f2. Change-Id: I440d5fc2f11e49018adf291b5f0c96c234d962ee
This commit is contained in:
parent
169f0deed4
commit
8d36e2e52a
@ -258,7 +258,6 @@ void DockItem::showContextMenu()
|
||||
void DockItem::menuActionClicked(QAction *action)
|
||||
{
|
||||
invokedMenuItem(action->data().toString(), true);
|
||||
m_contextMenu->hide();
|
||||
}
|
||||
|
||||
void DockItem::onContextMenuAccepted()
|
||||
|
@ -42,8 +42,8 @@ Menu::Menu(QWidget *dockItem, QWidget *parent)
|
||||
if (m_dockItem)
|
||||
m_dockItem->installEventFilter(this);
|
||||
|
||||
// 按下任务栏以外区域释放鼠标时,关闭右键菜单,否则会导致点击菜单项后无响应
|
||||
connect(m_eventInter, &XEventMonitor::ButtonRelease, this, &Menu::onButtonPress);
|
||||
// 点击任务栏以外区域时,关闭右键菜单
|
||||
connect(m_eventInter, &XEventMonitor::ButtonPress, this, &Menu::onButtonPress);
|
||||
}
|
||||
|
||||
void Menu::onButtonPress()
|
||||
@ -72,6 +72,27 @@ bool Menu::eventFilter(QObject *watched, QEvent *event)
|
||||
// 按下应用拖动,按下应用从菜单上方移动时,鼠标滚轮滚动时,隐藏右键菜单
|
||||
hide();
|
||||
}
|
||||
|
||||
// 当右键菜单显示时捕获鼠标的release事件,click=press+release,
|
||||
// 让click无效,从而让启动器窗口不关闭
|
||||
if (event->type() == QEvent::MouseButtonRelease) {
|
||||
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent->source() == Qt::MouseEventSynthesizedByQt) {
|
||||
if (isVisible())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理当右键菜单显示时,esc按下,关闭右键菜单,保持和模态框一样的效果
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if (keyEvent->key() == Qt::Key_Escape) {
|
||||
if (isVisible()) {
|
||||
hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QMenu::eventFilter(watched, event);
|
||||
|
@ -42,13 +42,13 @@ DWIDGET_USE_NAMESPACE
|
||||
FashionTrayWidgetWrapper::FashionTrayWidgetWrapper(const QString &itemKey, AbstractTrayWidget *absTrayWidget, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_absTrayWidget(absTrayWidget)
|
||||
, m_touchSignalManager(TouchSignalManager::instance())
|
||||
, m_layout(new QVBoxLayout(this))
|
||||
, m_attention(false)
|
||||
, m_dragging(false)
|
||||
, m_hover(false)
|
||||
, m_pressed(false)
|
||||
, m_itemKey(itemKey)
|
||||
|
||||
{
|
||||
setStyleSheet("background: transparent;");
|
||||
setAcceptDrops(true);
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <com_deepin_daemon_gesture.h>
|
||||
|
||||
using Gesture = com::deepin::daemon::Gesture;
|
||||
class TouchSignalManager;
|
||||
|
||||
#define TRAY_ITEM_DRAG_MIMEDATA "TrayItemDragDrop"
|
||||
|
||||
@ -71,10 +70,7 @@ private:
|
||||
void onTrayWidgetClicked();
|
||||
|
||||
private:
|
||||
// 动态加载的插件内存空间与dock进程内存空间相互独立,创建手势服务,监听触摸按下动作
|
||||
QPointer<AbstractTrayWidget> m_absTrayWidget;
|
||||
|
||||
QPointer<TouchSignalManager> m_touchSignalManager;
|
||||
QVBoxLayout *m_layout;
|
||||
|
||||
bool m_attention;
|
||||
|
@ -456,7 +456,6 @@ void SystemTrayItem::showContextMenu()
|
||||
void SystemTrayItem::menuActionClicked(QAction *action)
|
||||
{
|
||||
invokedMenuItem(action->data().toString(), true);
|
||||
m_contextMenu->hide();
|
||||
}
|
||||
|
||||
void SystemTrayItem::onContextMenuAccepted()
|
||||
|
Loading…
x
Reference in New Issue
Block a user