mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix popup window mouse area event error
Change-Id: I9892864ebeaa5a5b5180511567ab0f95b34690aa
This commit is contained in:
parent
6cd10fa3cf
commit
a916bf5af9
@ -17,6 +17,10 @@ DockPopupWindow::DockPopupWindow(QWidget *parent)
|
||||
connect(m_mouseInter, &DBusXMouseArea::ButtonRelease, this, &DockPopupWindow::globalMouseRelease);
|
||||
}
|
||||
|
||||
DockPopupWindow::~DockPopupWindow()
|
||||
{
|
||||
}
|
||||
|
||||
bool DockPopupWindow::model() const
|
||||
{
|
||||
return m_model;
|
||||
@ -28,22 +32,38 @@ void DockPopupWindow::show(const QPoint &pos, const bool model)
|
||||
|
||||
DArrowRectangle::show(pos.x(), pos.y());
|
||||
|
||||
if (model)
|
||||
if (!model && !m_mouseAreaKey.isEmpty())
|
||||
{
|
||||
m_mouseInter->UnregisterArea(m_mouseAreaKey);
|
||||
m_mouseAreaKey.clear();
|
||||
}
|
||||
|
||||
if (model && m_mouseAreaKey.isEmpty())
|
||||
m_mouseAreaKey = m_mouseInter->RegisterFullScreen();
|
||||
}
|
||||
|
||||
void DockPopupWindow::hide()
|
||||
{
|
||||
if (!m_mouseAreaKey.isEmpty())
|
||||
{
|
||||
m_mouseInter->UnregisterArea(m_mouseAreaKey);
|
||||
m_mouseAreaKey.clear();
|
||||
}
|
||||
|
||||
DArrowRectangle::hide();
|
||||
}
|
||||
|
||||
void DockPopupWindow::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
DArrowRectangle::mousePressEvent(e);
|
||||
|
||||
if (e->button() == Qt::LeftButton)
|
||||
m_acceptDelayTimer->start();
|
||||
// if (e->button() == Qt::LeftButton)
|
||||
// m_acceptDelayTimer->start();
|
||||
}
|
||||
|
||||
void DockPopupWindow::globalMouseRelease()
|
||||
{
|
||||
if (!m_model)
|
||||
return;
|
||||
Q_ASSERT(m_model);
|
||||
|
||||
const QRect rect = QRect(pos(), size());
|
||||
const QPoint pos = QCursor::pos();
|
||||
@ -54,4 +74,5 @@ void DockPopupWindow::globalMouseRelease()
|
||||
emit accept();
|
||||
|
||||
m_mouseInter->UnregisterArea(m_mouseAreaKey);
|
||||
m_mouseAreaKey.clear();
|
||||
}
|
||||
|
@ -11,11 +11,13 @@ class DockPopupWindow : public Dtk::Widget::DArrowRectangle
|
||||
|
||||
public:
|
||||
explicit DockPopupWindow(QWidget *parent = 0);
|
||||
~DockPopupWindow();
|
||||
|
||||
bool model() const;
|
||||
|
||||
public slots:
|
||||
void show(const QPoint &pos, const bool model = false);
|
||||
void hide();
|
||||
|
||||
signals:
|
||||
void accept() const;
|
||||
|
@ -1,10 +1,15 @@
|
||||
#include "diskcontrolwidget.h"
|
||||
|
||||
DiskControlWidget::DiskControlWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
: QScrollArea(parent),
|
||||
|
||||
m_diskInter(new DBusDiskMount(this))
|
||||
{
|
||||
setFixedWidth(300);
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setStyleSheet("background-color:transparent;");
|
||||
|
||||
connect(m_diskInter, &DBusDiskMount::DiskListChanged, this, &DiskControlWidget::diskListChanged);
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#include "dbus/dbusdiskmount.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScrollArea>
|
||||
|
||||
class DiskControlWidget : public QWidget
|
||||
class DiskControlWidget : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user