Fix the position of the initial popup message
ClosedPublic

Authored by ltoscano on Apr 30 2017, 2:34 PM.

Details

Summary

The initial popup message appears in the wrong position (central position
on the left side, with its left boundary outside the screen).

Add a bit of delay before displaying the message. A simple singleShot
with no delay seems to be enough to move the creation of the popup
after that the initialization of the window (personal guess) is ready.

Test Plan

The program compiles and the initial popup is shown in the correct position.

Diff Detail

Repository
R397 Kigo
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ltoscano created this revision.Apr 30 2017, 2:34 PM
Restricted Application added a reviewer: KDE Games. · View Herald TranscriptApr 30 2017, 2:34 PM
Restricted Application added a subscriber: KDE Games. · View Herald Transcript

And according the Frameworks policy, lambdas have been acceptable for a long time: https://community.kde.org/Frameworks/Policies#Frameworks_compiler_requirements_and_C.2B.2B11

schwarzer accepted this revision.EditedMay 3 2017, 3:01 PM

Although I do not like those "just delay it a bit and it will work" solutions that much, I also think it's a valid workaround here. :)

Update: I just realised that you are passing around a pointer. So passing it by copy is fine. :)

This revision is now accepted and ready to land.May 3 2017, 3:01 PM

Just out of curiosity. Why do you pass by value?

The lambda? Because I'm not so good C++ developer. I can try.

schwarzer added a comment.EditedMay 3 2017, 3:20 PM

OK. :D
I am not very familiar with labdas either and was just wondering. It works well here with =, & and this but I do not know the best practices in this case.

After reading https://medium.com/genymobile/how-c-lambda-expressions-can-improve-your-qt-code-8cd524f4ed9f I get the impression that capturing this is common practice.

schwarzer requested changes to this revision.May 3 2017, 4:39 PM

As discussed on IRC, there will be some changes in a future revision...

This revision now requires changes to proceed.May 3 2017, 4:39 PM
ltoscano updated this revision to Diff 14126.May 3 2017, 8:53 PM
ltoscano edited edge metadata.

Use the context for QTimer and only pass "this" to the lambda

schwarzer accepted this revision.Jun 23 2017, 6:19 AM

Sorry, forgot about this one. Thanks for taking action here. :)

This revision is now accepted and ready to land.Jun 23 2017, 6:19 AM
This revision was automatically updated to reflect the committed changes.