How to find the Qt version?

How to find out which version of Qt I am using. When I open Qt Creator, it shows that you like Qt Creator 2.3. IN Build Setting Shows Qt Version Qt 4.7.1. Please help me.

+6
source share
4 answers

Starting with Qt 5.3 you can use:

qtdiag 

This prints a ton of useful information. The first line includes the version:

 Qt 5.5.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160407) on "xcb" 
+5
source

All version information is in PyQt5.Qt:

 from PyQt5 import Qt vers = ['%s = %s' % (k,v) for k,v in vars(Qt).items() if k.lower().find('version') >= 0 and not inspect.isbuiltin(v)] print('\n'.join(sorted(vers))) 

prints

 PYQT_VERSION = 328193 PYQT_VERSION_STR = 5.2.1 QOpenGLVersionProfile = <class 'PyQt5.QtGui.QOpenGLVersionProfile'> QT_VERSION = 328192 QT_VERSION_STR = 5.2.0 qVersion = <built-in function qVersion> qWebKitMajorVersion = <built-in function qWebKitMajorVersion> qWebKitMinorVersion = <built-in function qWebKitMinorVersion> qWebKitVersion = <built-in function qWebKitVersion> 

Functions can also be called:

 >>> vers = ['%s = %s' % (k,v()) for k,v in vars(Qt).items() if k.lower().find('version') >= 0 and inspect.isbuiltin(v)] >>> print('\n'.join(sorted(vers))) qVersion = 5.2.0 qWebKitMajorVersion = 538 qWebKitMinorVersion = 1 qWebKitVersion = 538.1 
+3
source

You are using Qt version 4.7.1 because it is the qmake version. You can also use the qmake -v shell type to get it. Another version, namely 2.3, is the version of Qt Creator, not Qt

+2
source

qmake-qt5 --version

or

qmake --version

+1
source

All Articles