@@ -43,31 +43,8 @@ namespace Core::Internal {
4343
4444 void ProjectStartupTimerAddOn::extensionsInitialized () {
4545 auto windowInterface = windowHandle ()->cast <ProjectWindowInterface>();
46- auto window = qobject_cast<QQuickWindow *>(windowInterface->window ());
47- Q_ASSERT (window);
48- connect (window, &QQuickWindow::sceneGraphInitialized, this , [=] {
49- QTimer::singleShot (0 , [=] {
50- m_finishedMessage = new NotificationMessage (windowInterface->window ());
51- m_finishedMessage->setIcon (SVS::SVSCraft::Success);
52- auto elapsedTime = stopTimerAndGetElapsedTime ();
53- if (elapsedTime != -1 ) {
54- double second = elapsedTime / 1000.0 ;
55- m_finishedMessage->setTitle (tr (" Project window initialized in %1 seconds" ).arg (second, 0 , ' f' , 3 ));
56- } else {
57- m_finishedMessage->setTitle (tr (" Project window initialized" ));
58- }
59- m_finishedMessage->setAllowDoNotShowAgain (notificationVisible ());
60- connect (m_finishedMessage, &NotificationMessage::doNotShowAgainRequested, this , [=] {
61- setNotificationVisible (false );
62- m_finishedMessage->setAllowDoNotShowAgain (false );
63- });
64- windowInterface->sendNotification (m_finishedMessage, notificationVisible () ? ProjectWindowInterface::AutoHide : ProjectWindowInterface::DoNotShowBubble);
65- m_initializingMessage->close ();
66- if (elapsedTime > 60000 ) {
67- CoreAchievementsModel::triggerAchievementCompleted (CoreAchievementsModel::Achievement_KeepPatient);
68- }
69- });
70- });
46+ auto window = windowInterface->window ();
47+ window->installEventFilter (this );
7148 }
7249
7350 bool ProjectStartupTimerAddOn::delayedInitialize () {
@@ -105,4 +82,33 @@ namespace Core::Internal {
10582 settings->endGroup ();
10683 return visible;
10784 }
85+ bool ProjectStartupTimerAddOn::eventFilter (QObject *watched, QEvent *event) {
86+ auto windowInterface = windowHandle ()->cast <ProjectWindowInterface>();
87+ auto window = windowInterface->window ();
88+ if (event->type () == QEvent::Expose && window->isExposed ()) {
89+ QTimer::singleShot (0 , [=] {
90+ m_finishedMessage = new NotificationMessage (windowInterface->window ());
91+ m_finishedMessage->setIcon (SVS::SVSCraft::Success);
92+ auto elapsedTime = stopTimerAndGetElapsedTime ();
93+ if (elapsedTime != -1 ) {
94+ double second = elapsedTime / 1000.0 ;
95+ m_finishedMessage->setTitle (tr (" Project window initialized in %1 seconds" ).arg (second, 0 , ' f' , 3 ));
96+ } else {
97+ m_finishedMessage->setTitle (tr (" Project window initialized" ));
98+ }
99+ m_finishedMessage->setAllowDoNotShowAgain (notificationVisible ());
100+ connect (m_finishedMessage, &NotificationMessage::doNotShowAgainRequested, this , [=] {
101+ setNotificationVisible (false );
102+ m_finishedMessage->setAllowDoNotShowAgain (false );
103+ });
104+ windowInterface->sendNotification (m_finishedMessage, notificationVisible () ? ProjectWindowInterface::AutoHide : ProjectWindowInterface::DoNotShowBubble);
105+ m_initializingMessage->close ();
106+ if (elapsedTime > 60000 ) {
107+ CoreAchievementsModel::triggerAchievementCompleted (CoreAchievementsModel::Achievement_KeepPatient);
108+ }
109+ });
110+ window->removeEventFilter (this );
111+ }
112+ return WindowInterfaceAddOn::eventFilter (watched, event);
113+ }
108114}
0 commit comments