qt, qt5: don't depend on png, jpeg.

Closes #21255.