dde-dock/frame/util/dockpopupwindow.h
donghualin e7dbbb0140 fix: 点击插件弹出自己的列表
1、删除已经移到插件中的文件
2、点击插件图标,弹出当前插件对应的列表

Log:
Influence: 点击插件,观察是否弹出插件自己对应的列表,如果没有弹出列表,则触发这个插件的功能
Task: https://pms.uniontech.com/task-view-222353.html
Change-Id: Ia8797ccbe630d56d79ab9138d5aa982b66f74c57
2023-01-12 13:54:06 +08:00

104 lines
2.7 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 "org_deepin_dde_xeventmonitor1.h"
#include <darrowrectangle.h>
#include <dregionmonitor.h>
#include <DWindowManagerHelper>
DWIDGET_USE_NAMESPACE
DGUI_USE_NAMESPACE
using XEventMonitor = org::deepin::dde::XEventMonitor1;
class DockPopupWindow : public Dtk::Widget::DArrowRectangle
{
Q_OBJECT
public:
explicit DockPopupWindow(QWidget *parent = 0);
~DockPopupWindow();
bool model() const;
void setContent(QWidget *content);
void setExtendWidget(QWidget *widget);
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 hideEvent(QHideEvent *event);
void enterEvent(QEvent *e);
bool eventFilter(QObject *o, QEvent *e);
void blockButtonRelease();
private slots:
void compositeChanged();
void ensureRaised();
void onButtonPress(int type, int x, int y, const QString &key);
private:
bool m_model;
QPoint m_lastPoint;
XEventMonitor *m_eventMonitor;
QString m_eventKey;
DWindowManagerHelper *m_wmHelper;
bool m_enableMouseRelease;
QWidget *m_extendWidget;
};
class PopupSwitchWidget : public QWidget
{
Q_OBJECT
public:
explicit PopupSwitchWidget(QWidget *parent = nullptr);
~PopupSwitchWidget();
void pushWidget(QWidget *widget);
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
private:
QVBoxLayout *m_containerLayout;
QWidget *m_topWidget;
};
#endif // DOCKPOPUPWINDOW_H