I came here googling because I had the same problem on Windows.
In my case, to solve the problem, I had to install PostgreSQL for Windows 32 bits, since my Qt target was 32 bits MinGW.
, PATH bin lib PostgreSQL, Qt .dlls.
@SET PATH=C:\Program Files (x86)\PostgreSQL\9.6\bin\;C:\Program Files (x86)\PostgreSQL\9.6\lib\;%PATH%
PATH Qt Creator Qt Creator Build Environment Projects.