get focus when show

Change-Id: I00ed2816bb9a90eb1e815f4be29418257654b98d
This commit is contained in:
石博文 2016-09-05 14:33:57 +08:00
parent df0d9d1147
commit fe212ce82a
Notes: Deepin Code Review 2016-09-05 06:41:44 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Mon, 05 Sep 2016 06:41:44 +0000
Reviewed-on: https://cr.deepin.io/15846
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 13 additions and 0 deletions

View File

@ -70,11 +70,23 @@ void DockPopupWindow::hide()
DArrowRectangle::hide();
}
void DockPopupWindow::showEvent(QShowEvent *e)
{
DArrowRectangle::showEvent(e);
QTimer::singleShot(1, this, [&] {
raise();
activateWindow();
setFocus(Qt::ActiveWindowFocusReason);
});
}
void DockPopupWindow::enterEvent(QEvent *e)
{
DArrowRectangle::enterEvent(e);
raise();
activateWindow();
setFocus(Qt::ActiveWindowFocusReason);
}

View File

@ -26,6 +26,7 @@ signals:
void accept() const;
protected:
void showEvent(QShowEvent *e);
void enterEvent(QEvent *e);
void mousePressEvent(QMouseEvent *e);
bool eventFilter(QObject *o, QEvent *e);