hide popup when mouse press

Change-Id: I057b43dd1698b775c79d71972519278da1d770ff
This commit is contained in:
石博文 2016-08-09 10:58:47 +08:00
parent e3e3d768ad
commit 56654bd0b9
Notes: Deepin Code Review 2016-08-09 03:05:53 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Tue, 09 Aug 2016 03:05:53 +0000
Reviewed-on: https://cr.deepin.io/15009
Project: dde/dde-dock
Branch: refs/heads/master
3 changed files with 12 additions and 9 deletions

View File

@ -231,9 +231,6 @@ void AppItem::paintEvent(QPaintEvent *e)
painter.drawPixmap(itemRect.center() - pixmap.rect().center(), ImageFactory::lighterEffect(pixmap));
// Update the window icon geometry when the icon is changed.
if (m_updateIconGeometryTimer->isActive()) {
m_updateIconGeometryTimer->stop();
}
m_updateIconGeometryTimer->start();
}
@ -249,6 +246,9 @@ void AppItem::mouseReleaseEvent(QMouseEvent *e)
void AppItem::mousePressEvent(QMouseEvent *e)
{
m_updateIconGeometryTimer->stop();
hidePopup();
if (e->button() == Qt::RightButton)
{
if (perfectIconRect().contains(e->pos()))

View File

@ -101,10 +101,7 @@ void DockItem::leaveEvent(QEvent *e)
// auto hide if popup is not model window
if (m_popupShown && !PopupWindow->model())
{
m_popupShown = false;
PopupWindow->hide();
}
hidePopup();
update();
}
@ -213,8 +210,7 @@ void DockItem::popupWindowAccept()
disconnect(PopupWindow.get(), &DockPopupWindow::accept, this, &DockItem::popupWindowAccept);
m_popupShown = false;
PopupWindow->hide();
hidePopup();
emit requestWindowAutoHide(true);
}
@ -264,3 +260,9 @@ const QPoint DockItem::popupMarkPoint()
return p;
}
void DockItem::hidePopup()
{
m_popupShown = false;
PopupWindow->hide();
}

View File

@ -49,6 +49,7 @@ protected:
const QRect perfectIconRect() const;
const QPoint popupMarkPoint();
void hidePopup();
void showContextMenu();
void showHoverTips();
void popupWindowAccept();