show panel when drag entered

Change-Id: Ib02de4730e10360e46d1cced96864235d600a85b
This commit is contained in:
石博文 2017-07-04 14:34:38 +08:00
parent 756f9ede9e
commit fb7a00d54a
Notes: Deepin Code Review 2017-07-04 14:56:22 +08:00
Verified+1: Anonymous Coward #1000004
Verified+1: <zhaofangfang@linuxdeepin.com>
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Tue, 04 Jul 2017 14:56:20 +0800
Reviewed-on: https://cr.deepin.io/24248
Project: dde/dde-dock
Branch: refs/heads/master
4 changed files with 20 additions and 0 deletions

View File

@ -33,6 +33,7 @@ AppSnapshot::AppSnapshot(const WId wid, QWidget *parent)
centralLayout->setMargin(0);
setLayout(centralLayout);
setAcceptDrops(true);
connect(m_closeBtn, &DImageButton::clicked, this, &AppSnapshot::closeWindow, Qt::QueuedConnection);
connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &AppSnapshot::compositeChanged, Qt::QueuedConnection);
@ -72,6 +73,14 @@ void AppSnapshot::setWindowTitle(const QString &title)
m_title->setText(title);
}
void AppSnapshot::dragEnterEvent(QDragEnterEvent *e)
{
QWidget::dragEnterEvent(e);
if (m_wmHelper->hasComposite())
emit entered(m_wid);
}
void AppSnapshot::fetchSnapshot()
{
if (!m_wmHelper->hasComposite())

View File

@ -34,6 +34,7 @@ public slots:
void setWindowTitle(const QString &title);
private:
void dragEnterEvent(QDragEnterEvent *e);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void paintEvent(QPaintEvent *e);

View File

@ -32,6 +32,7 @@ MainWindow::MainWindow(QWidget *parent)
setAccessibleName("dock-mainwindow");
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
setAttribute(Qt::WA_TranslucentBackground);
setAcceptDrops(true);
m_platformWindowHandle.setEnableBlurWindow(false);
m_platformWindowHandle.setTranslucentBackground(true);
@ -111,6 +112,14 @@ void MainWindow::leaveEvent(QEvent *e)
updatePanelVisible();
}
void MainWindow::dragEnterEvent(QDragEnterEvent *e)
{
QWidget::dragEnterEvent(e);
if (m_settings->hideState() != Show)
m_expandDelayTimer->start();
}
void MainWindow::setFixedSize(const QSize &size)
{
const QPropertyAnimation::State state = m_sizeChangeAni->state();

View File

@ -30,6 +30,7 @@ private:
void keyPressEvent(QKeyEvent *e);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void dragEnterEvent(QDragEnterEvent *e);
void setFixedSize(const QSize &size);
void move(int x, int y);