fix: fashion tray expand error after double click control widget

https://github.com/linuxdeepin/internal-discussion/issues/932

Change-Id: I1dcd2985955893d42a297d70a865a49e890ee904
This commit is contained in:
listenerri 2019-02-13 13:54:51 +08:00
parent 3962f474e9
commit 49b84eb0cc
Notes: gerrit 2019-02-14 14:46:34 +08:00
Verified+1: <jenkins@deepin.com>
Verified+1: liuwen123 <liuwen@linuxdeepin.com>
Code-Review+2: listenerri <listenerri@gmail.com>
Submitted-by: listenerri <listenerri@gmail.com>
Submitted-at: Thu, 14 Feb 2019 14:46:34 +0800
Reviewed-on: https://cr.deepin.io/41600
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 11 additions and 0 deletions

View File

@ -31,11 +31,15 @@ DWIDGET_USE_NAMESPACE
FashionTrayControlWidget::FashionTrayControlWidget(Dock::Position position, QWidget *parent)
: QWidget(parent),
m_expandDelayTimer(new QTimer(this)),
m_dockPosition(position),
m_expanded(true),
m_hover(false),
m_pressed(false)
{
m_expandDelayTimer->setInterval(400);
m_expandDelayTimer->setSingleShot(true);
setDockPostion(m_dockPosition);
setExpanded(m_expanded);
}
@ -106,6 +110,12 @@ void FashionTrayControlWidget::paintEvent(QPaintEvent *event)
void FashionTrayControlWidget::mouseReleaseEvent(QMouseEvent *event)
{
if (m_expandDelayTimer->isActive()) {
return;
}
m_expandDelayTimer->start();
m_pressed = false;
update();

View File

@ -52,6 +52,7 @@ private:
void refreshArrowPixmap();
private:
QTimer *m_expandDelayTimer;
QPixmap m_arrowPix;
Dock::Position m_dockPosition;