From d772fe206db297375625093f7796b42a9d97784f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=8D=9A=E6=96=87?= Date: Mon, 6 Mar 2017 09:45:38 +0800 Subject: [PATCH] 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 --- frame/item/dockitem.cpp | 11 ++++++----- frame/item/dockitem.h | 2 +- frame/item/launcheritem.cpp | 3 +++ frame/util/dockpopupwindow.cpp | 14 +++++++++++++- frame/util/dockpopupwindow.h | 4 +--- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/frame/item/dockitem.cpp b/frame/item/dockitem.cpp index fde7fa52d..845547fc1 100644 --- a/frame/item/dockitem.cpp +++ b/frame/item/dockitem.cpp @@ -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(); } diff --git a/frame/item/dockitem.h b/frame/item/dockitem.h index f974df240..20ec1d3c2 100644 --- a/frame/item/dockitem.h +++ b/frame/item/dockitem.h @@ -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); diff --git a/frame/item/launcheritem.cpp b/frame/item/launcheritem.cpp index c15bb9f9c..e742fae01 100644 --- a/frame/item/launcheritem.cpp +++ b/frame/item/launcheritem.cpp @@ -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(&QProcess::finished), proc, &QProcess::deleteLater); diff --git a/frame/util/dockpopupwindow.cpp b/frame/util/dockpopupwindow.cpp index cb175a062..9539ce856 100644 --- a/frame/util/dockpopupwindow.cpp +++ b/frame/util/dockpopupwindow.cpp @@ -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()) diff --git a/frame/util/dockpopupwindow.h b/frame/util/dockpopupwindow.h index ee45236f4..9d727f8d9 100644 --- a/frame/util/dockpopupwindow.h +++ b/frame/util/dockpopupwindow.h @@ -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;