dde-dock/frame/util/dockpopupwindow.h
YinJie 5a00e46e1a fix: 修复点击图标不显示弹窗的问题
现象:在ZHAOXIN设备上出现点击音量、网络插件大概率不出现弹窗。
原因:DRegionMonitor::buttonRelease和Qt的MouseRelease事件顺序不可控,会导致在显示了弹窗之后又把它隐藏了。
处理方案:在显示弹窗后添加一个10ms的延时,不处理buttonRelease事件。

Log:
Bug: https://pms.uniontech.com/zentao/bug-view-109423.html
Influence: 鼠标左键点击托盘插件的场景,观察弹窗的显示和隐藏。
Change-Id: I7266d64699da51f2f453bbce5b2b71be555132fd
2022-01-05 17:13:15 +08:00

78 lines
2.1 KiB
C++

/*
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw <sbw@sbw.so>
*
* Maintainer: sbw <sbw@sbw.so>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DOCKPOPUPWINDOW_H
#define DOCKPOPUPWINDOW_H
#include <darrowrectangle.h>
#include <dregionmonitor.h>
#include <DWindowManagerHelper>
DWIDGET_USE_NAMESPACE
DGUI_USE_NAMESPACE
class DockPopupWindow : public Dtk::Widget::DArrowRectangle
{
Q_OBJECT
public:
explicit DockPopupWindow(QWidget *parent = 0);
~DockPopupWindow();
bool model() const;
void setContent(QWidget *content);
public slots:
void show(const QPoint &pos, const bool model = false);
void show(const int x, const int y);
void hide();
signals:
void accept() const;
// 在把专业版的仓库降级到debian的stable时, dock出现了一个奇怪的问题:
// 在plugins/tray/system-trays/systemtrayitem.cpp中的showPopupWindow函数中
// 无法连接到上面这个信号: "accept", qt给出一个运行时警告提示找不到信号
// 目前的解决方案就是在下面增加了这个信号
void unusedSignal();
protected:
void showEvent(QShowEvent *e);
void enterEvent(QEvent *e);
bool eventFilter(QObject *o, QEvent *e);
void blockButtonRelease();
private slots:
void onGlobMouseRelease(const QPoint &mousePos, const int flag);
void compositeChanged();
void ensureRaised();
private:
bool m_model;
QPoint m_lastPoint;
DRegionMonitor *m_regionInter;
DWindowManagerHelper *m_wmHelper;
bool m_enableMouseRelease;
};
#endif // DOCKPOPUPWINDOW_H