Git commit a829c459a365eaadc200359b828ce5fa70395c3f by Sven Brauch. Committed on 31/01/2014 at 16:09. Pushed by brauch into branch 'master'. assistant: Prevent QGraphicsView from raising a window activation event Different from QToolBar (which the old assistant inherited from), QGraphicsView raises a WindowActivate event when it is shown. There is a flag (WA_ShowWithoutActivating) which *should* prevent that but it does not work. Thus, we re-implement QGraphicsView's ViewportEvent and take the Show event away from it. This is an ugly hack. However, with Qt5, QDeclarativeView goes away anyways; so it is guaranteed to go away in at most half a year, when I port this code to KDevelop 5. Until then, it's not going to break, since Qt4 will not change. CCMAIL:mail@milianw.de M +12 -0 shell/assistantpopup.cpp M +1 -0 shell/assistantpopup.h http://commits.kde.org/kdevplatform/a829c459a365eaadc200359b828ce5fa70395c3f diff --git a/shell/assistantpopup.cpp b/shell/assistantpopup.cpp index 8f91b68..09e2bac 100644 --- a/shell/assistantpopup.cpp +++ b/shell/assistantpopup.cpp @@ -80,6 +80,18 @@ AssistantPopup::AssistantPopup(KTextEditor::View* parent= , const IAssistant::Ptr& m_view->installEventFilter(this); } = +bool AssistantPopup::viewportEvent(QEvent *event) +{ + // For some reason, QGraphicsView posts a WindowActivate event + // when it is shown, even if disabled through setting the WA_ShowWitho= utActivate + // attribute. This causes all focus-driven popups (QuickOpen, tooltips= , ...) + // to hide when the assistant opens. Thus, prevent it from processing = the Show event here. + if ( event->type() =3D=3D QEvent::Show ) { + return true; + } + return QGraphicsView::viewportEvent(event); +} + AssistantPopupConfig::AssistantPopupConfig(QObject *parent): QObject(paren= t) { = diff --git a/shell/assistantpopup.h b/shell/assistantpopup.h index 0f838f0..c279fba 100644 --- a/shell/assistantpopup.h +++ b/shell/assistantpopup.h @@ -103,6 +103,7 @@ public: */ AssistantPopup(KTextEditor::View* widget, const KDevelop::IAssistant::= Ptr& assistant); KDevelop::IAssistant::Ptr assistant() const; + virtual bool viewportEvent(QEvent *event); = public slots: void executeHideAction();