Fix launcher auto-hide

the popup tips window get active event, so launcher is into deactived
need to forbid tips window get focus.

Change-Id: Idcc01e87e954bde36bd776f466668605f256ddfd
This commit is contained in:
石博文 2017-03-06 09:45:38 +08:00
parent e5e5e46f08
commit d772fe206d
Notes: Deepin Code Review 2017-03-06 11:02:47 +08:00
Verified+1: Anonymous Coward #1000004
Verified+1: electricface <songwentai@deepin.com>
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Mon, 06 Mar 2017 11:02:47 +0800
Reviewed-on: https://cr.deepin.io/21063
Project: dde/dde-dock
Branch: refs/heads/master
5 changed files with 24 additions and 10 deletions

View File

@ -75,12 +75,12 @@ void DockItem::moveEvent(QMoveEvent *e)
updatePopupPosition();
}
void DockItem::mouseMoveEvent(QMouseEvent *e)
{
QWidget::mouseMoveEvent(e);
//void DockItem::mouseMoveEvent(QMouseEvent *e)
//{
// QWidget::mouseMoveEvent(e);
m_popupTipsDelayTimer->start();
}
// m_popupTipsDelayTimer->start();
//}
void DockItem::mousePressEvent(QMouseEvent *e)
{
@ -270,6 +270,7 @@ const QPoint DockItem::popupMarkPoint()
void DockItem::hidePopup()
{
m_popupTipsDelayTimer->stop();
m_popupShown = false;
PopupWindow->hide();
}

View File

@ -45,7 +45,7 @@ signals:
protected:
void paintEvent(QPaintEvent *e);
void moveEvent(QMoveEvent *e);
void mouseMoveEvent(QMouseEvent *e);
// void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);

View File

@ -59,6 +59,9 @@ void LauncherItem::mousePressEvent(QMouseEvent *e)
if (e->button() != Qt::LeftButton)
return;
// hide the tips window, because this window activate event will trigger dde-launcher auto-hide
hidePopup();
QProcess *proc = new QProcess;
connect(proc, static_cast<void (QProcess::*)(int)>(&QProcess::finished), proc, &QProcess::deleteLater);

View File

@ -53,7 +53,7 @@ void DockPopupWindow::show(const QPoint &pos, const bool model)
m_model = model;
m_lastPoint = pos;
DArrowRectangle::show(pos.x(), pos.y());
show(pos.x(), pos.y());
if (!model && !m_mouseAreaKey.isEmpty())
unRegisterMouseEvent();
@ -62,6 +62,18 @@ void DockPopupWindow::show(const QPoint &pos, const bool model)
registerMouseEvent();
}
void DockPopupWindow::show(const int x, const int y)
{
resizeWithContent();
m_lastPos = QPoint(x, y);
move(x, y);
if (!isVisible())
QWidget::show();
update();
}
void DockPopupWindow::hide()
{
if (!m_mouseAreaKey.isEmpty())

View File

@ -20,6 +20,7 @@ public:
public slots:
void show(const QPoint &pos, const bool model = false);
void show(const int x, const int y);
void hide();
signals:
@ -36,9 +37,6 @@ private slots:
void registerMouseEvent();
void unRegisterMouseEvent();
private:
using Dtk::Widget::DArrowRectangle::show;
private:
bool m_model;
QPoint m_lastPoint;