How to find Version of Qt?

泄露秘密 提交于 2019-12-04 08:54:09

问题


How do I know which version of Qt I am using? When I open Qt Creator it shows "Welcome to Qt Creator 2.3". In the build setting, however, it shows Qt Version 4.7.1.


回答1:


qmake-qt5 --version

or

qmake --version




回答2:


Starting with Qt 5.3 you can use:

qtdiag

This prints a bunch 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" 



回答3:


All the version info is in PyQt5.Qt:

import inspect
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>

The functions can be called too:

>>> 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



回答4:


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



来源:https://stackoverflow.com/questions/23058718/how-to-find-version-of-qt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!