Related Qt report: https://bugreports.qt.io/browse/QTBUG-95549
Calling pinentry-qt without setting the DISPLAY variable can result in an inmediate crash, leading to gpg-agent not working if not connected to a TTY. This can be reproduced as follows:
$ DISPLAY= QT_QPA_PLATFORMTHEME=gtk3 pinentry-qt --display :0 (pinentry-qt:11296): Gtk-WARNING **: 10:51:29.093: cannot open display:
This is due to libqgtk3.so relying on the DISPLAY variable instead of the --display flag. However, this will only happen on Xorg, as the wayland equivalent, WAYLAND_DISPLAY, is set properly. I propose setting DISPLAY as well.