Page MenuHome GnuPG

qt: Fix build against Qt4.

Authored by aheinecke on Jan 24 2021, 12:43 AM.



Recent changes in pinentry-qt (a421ae8 and 84d473f) made use of features only available in Qt5, namely the QWindow class and the possibility to use a lambda instead of a slot in QTimer::singleShot. This resulted in pinentry-qt failing to build against Qt4.

This patch tries to restore support for Qt4.

Test Plan

With the patch applied, pinentry-qt 1.1.1 compiles cleanly against Qt-4.8.7 and *seems* to be working properly. However I’m unsure if the patch is the right thing to do, as I am not familiar enough with Qt and with the issues that @aheinecke was trying to fix with the commits referenced above.

Diff Detail

rP Pinentry
Lint Skipped
Unit Tests Skipped

Event Timeline

aheinecke edited reviewers, added: gouttegd; removed: aheinecke.
aheinecke edited edge metadata.

Thanks for noticing, I did not have Qt4 on my radar when writing this. The delayed raise with the timer might be only necessary on windows, on linux we don't have reports that just doing an activateWindow and raise does not work. So this is mostly for windows and there the Qt4 pinentry is not relevant.

I've added a comment for clarification and fixed it by ifdefing the minimize / raise part. The changes to main are okay. This should not be a change in behavior against previous pinentry-qt4 versions.


This does not work, with Qt5 you can use the lambda to call arbitrary code like the void raiseWindow
A real "SLOT" must always be declared on a Q_OBJECT.

This compiles but at runtime you get:
10:51:37.350 ?pinentry-qt?|?pinentry-qt?|?pinentry-qt?|?pinentry-qt?|? QTimer::singleShot: Invalid slot specification. You are also not passing the "w" parameter.

Modified and commited with: rev. 2859eddfb0c935d3f9eb9ccc1b42c121621123e9 I'm not sure if phabricator automatically does it when I mention the differential as GnuPG-Bug-Id