mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix(dockitem): popup applet position error
Change-Id: I96272a5ff3e858b0d4d74fb1ae5c790c6e706523
This commit is contained in:
parent
9485d5a4db
commit
ec1ca53eef
Notes:
gerrit
2018-03-15 09:18:59 +00:00
Verified+1: Anonymous Coward #1000004 Verified+1: <yefei@linuxdeepin.com> Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Thu, 15 Mar 2018 09:18:58 +0000 Reviewed-on: https://cr.deepin.io/32647 Project: dde/dde-dock Branch: refs/heads/master
@ -104,9 +104,12 @@ void DockItem::updatePopupPosition()
|
||||
{
|
||||
Q_ASSERT(sender() == m_popupAdjustDelayTimer);
|
||||
|
||||
if (!m_popupShown || !PopupWindow->isVisible())
|
||||
if (!m_popupShown || !PopupWindow->model())
|
||||
return;
|
||||
|
||||
if (PopupWindow->getContent() != m_lastPopupWidget.data())
|
||||
return popupWindowAccept();
|
||||
|
||||
const QPoint p = popupMarkPoint();
|
||||
PopupWindow->show(p, PopupWindow->model());
|
||||
}
|
||||
@ -129,7 +132,8 @@ void DockItem::enterEvent(QEvent *e)
|
||||
{
|
||||
m_hover = true;
|
||||
m_hoverEffect->setHighlighting(true);
|
||||
m_popupTipsDelayTimer->start();
|
||||
if (!PopupWindow->model())
|
||||
m_popupTipsDelayTimer->start();
|
||||
|
||||
update();
|
||||
|
||||
@ -235,6 +239,7 @@ void DockItem::showHoverTips()
|
||||
void DockItem::showPopupWindow(QWidget * const content, const bool model)
|
||||
{
|
||||
m_popupShown = true;
|
||||
m_lastPopupWidget = content;
|
||||
|
||||
if (model)
|
||||
emit requestWindowAutoHide(false);
|
||||
@ -276,7 +281,7 @@ void DockItem::popupWindowAccept()
|
||||
void DockItem::showPopupApplet(QWidget * const applet)
|
||||
{
|
||||
// another model popup window is alread exists
|
||||
if (PopupWindow->isVisible() && PopupWindow->model())
|
||||
if (PopupWindow->model())
|
||||
return;
|
||||
|
||||
showPopupWindow(applet, true);
|
||||
@ -330,6 +335,7 @@ const QPoint DockItem::topleftPoint() const
|
||||
void DockItem::hidePopup()
|
||||
{
|
||||
m_popupTipsDelayTimer->stop();
|
||||
m_popupAdjustDelayTimer->stop();
|
||||
m_popupShown = false;
|
||||
PopupWindow->hide();
|
||||
|
||||
|
@ -98,6 +98,7 @@ protected:
|
||||
bool m_hover;
|
||||
bool m_popupShown;
|
||||
|
||||
QPointer<QWidget> m_lastPopupWidget;
|
||||
QPointer<HoverHighlightEffect> m_hoverEffect;
|
||||
|
||||
QTimer *m_popupTipsDelayTimer;
|
||||
|
@ -58,7 +58,7 @@ DockPopupWindow::~DockPopupWindow()
|
||||
|
||||
bool DockPopupWindow::model() const
|
||||
{
|
||||
return m_model;
|
||||
return isVisible() && m_model;
|
||||
}
|
||||
|
||||
void DockPopupWindow::setContent(QWidget *content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user