qt: Fix richtext detection hang issue on very old Qt versions

Alternative implementation. Thanks to @awoland for the original.
Fixes #3486.
Merge pull request #3577

17b409b qt: Fix richtext detection hang issue on very old Qt versions (Wladimir J. van der Laan)
build: fix typo in configure help message

--with-qt-libdir etc, not --with-gui-libdir.
The typo was introduced in a9dbcf036bc866c2e413b1d068541e35eafdfcd0.