如何在Mac OS X上检查安装的Qt版本?

时间:2021-08-07 19:24:10

Is there a command to check the version of the installed Qt on Mac OS X. My Mac OS X version is 10.6.7.

是否有一个命令可以检查Mac OS X上安装的Qt的版本,我的Mac OS X版本是10.6.7。

Eidt: Update the status 10/28/2011

Eidt:更新状态10/28/2011。

When running /usr/sbin/system_profiler SPFrameworksDataType, the version of the QTkit is 7.6.6.

当运行/usr/sbin/system_profiler SPFrameworksDataType时,QTkit的版本是7.6.6。

The value of the macro QT_VERSION_STR in qglobal.h is "4.7.2".

qglobal中宏QT_VERSION_STR的值。h是“4.7.2”。

I'm confused why the two version strings are different? Obviously, the version string "4.7.2" is what I want.

我不明白为什么两个版本的字符串不一样?显然,版本字符串“4.7.2”是我想要的。

Thanks, Jeffrey

谢谢你,杰弗瑞

6 个解决方案

#1


7  

IF you speak about programming here...: At compile time you can check Qt's version with QT_VERSION_STR. During runtime you can use qVersion(). Obviously, the version you build you application with does not always match the version you run it with.

如果你在这里谈论编程……:在编译时,可以使用QT_VERSION_STR检查Qt的版本。在运行时,您可以使用qVersion()。显然,您构建应用程序的版本并不总是与您运行的版本相匹配。

#2


14  

Go to your "Applications>>Tools" folder and launch the System-Profiler. Look at "Software>>Frameworks>>QTKit". There you will find the version.

进入你的“应用>>工具”文件夹并启动系统剖析器。查看“软件> > > > QTKit框架”。在那里你会找到它的版本。

To get in in a terminal (to use it from Java for example) execute the following command:

要进入终端(例如从Java中使用它),执行以下命令:

  /usr/sbin/system_profiler SPFrameworksDataType

There you will find something like this:

你会发现这样的东西:

  QTKit:

    Version: 7.7
    Last Modified: 13.04.11 16:02
    Kind: Universal
    64-Bit (Intel): Yes
    Get Info String: QTKit 7.7, Copyright 2003-2011, Apple Inc.
    Location: /System/Library/Frameworks/QTKit.framework
    Private: No

In XCode there should be an environment-variable available.

在XCode中,应该有一个可用的环境变量。

#3


11  

If you installed with brew, just do...

如果你安装了brew,就做…

brew info qt or brew info qt5

brew信息qt或brew info qt5。

Update:

更新:

Doing it this way will cut out all the extra stuff and only show versions.

这样做可以去掉所有多余的东西,只显示版本。

brew list --versions qt or brew list --versions qt5

brew列表——版本qt或brew列表——版本qt5。

Here's a nice cheatsheet for brew, btw: http://ricostacruz.com/cheatsheets/homebrew.html

这里有一个很好的brew cheatsheet, btw: http://ricostacruz.com/cheatsheets/homebrew.html。

#4


6  

On terminal:

终端:

qmake -v

qmake - v

It should return versions of QMake and Qt.

它应该返回QMake和Qt的版本。

Something like:

喜欢的东西:

QMake version 3.0

QMake 3.0版本

Using Qt version 5.6.2 in /Users/thiago/anaconda/lib

使用Qt 5.6.2 in / user /thiago/anaconda/lib。

#5


2  

If you can find where Qt's headers are installed, qglobal.h contains a define for QT_VERSION_STR. You can simply grep for that.

如果您能找到Qt的头安装在哪里,qglobal。h包含QT_VERSION_STR的定义。你可以用grep来表示。

#6


1  

cd to the include directory where your qt headers are located and then...

cd到包含qt头的目录,然后…

grep --include=\*.h -rnw ./ -e "QT_VERSION_STR"

which should output something like...

它应该输出诸如…

./QtCore/qglobal.h:40:#define QT_VERSION_STR "5.4.2"

/ QtCore / qglobal。h:40:# define QT_VERSION_STR“5.4.2”

#1


7  

IF you speak about programming here...: At compile time you can check Qt's version with QT_VERSION_STR. During runtime you can use qVersion(). Obviously, the version you build you application with does not always match the version you run it with.

如果你在这里谈论编程……:在编译时,可以使用QT_VERSION_STR检查Qt的版本。在运行时,您可以使用qVersion()。显然,您构建应用程序的版本并不总是与您运行的版本相匹配。

#2


14  

Go to your "Applications>>Tools" folder and launch the System-Profiler. Look at "Software>>Frameworks>>QTKit". There you will find the version.

进入你的“应用>>工具”文件夹并启动系统剖析器。查看“软件> > > > QTKit框架”。在那里你会找到它的版本。

To get in in a terminal (to use it from Java for example) execute the following command:

要进入终端(例如从Java中使用它),执行以下命令:

  /usr/sbin/system_profiler SPFrameworksDataType

There you will find something like this:

你会发现这样的东西:

  QTKit:

    Version: 7.7
    Last Modified: 13.04.11 16:02
    Kind: Universal
    64-Bit (Intel): Yes
    Get Info String: QTKit 7.7, Copyright 2003-2011, Apple Inc.
    Location: /System/Library/Frameworks/QTKit.framework
    Private: No

In XCode there should be an environment-variable available.

在XCode中,应该有一个可用的环境变量。

#3


11  

If you installed with brew, just do...

如果你安装了brew,就做…

brew info qt or brew info qt5

brew信息qt或brew info qt5。

Update:

更新:

Doing it this way will cut out all the extra stuff and only show versions.

这样做可以去掉所有多余的东西,只显示版本。

brew list --versions qt or brew list --versions qt5

brew列表——版本qt或brew列表——版本qt5。

Here's a nice cheatsheet for brew, btw: http://ricostacruz.com/cheatsheets/homebrew.html

这里有一个很好的brew cheatsheet, btw: http://ricostacruz.com/cheatsheets/homebrew.html。

#4


6  

On terminal:

终端:

qmake -v

qmake - v

It should return versions of QMake and Qt.

它应该返回QMake和Qt的版本。

Something like:

喜欢的东西:

QMake version 3.0

QMake 3.0版本

Using Qt version 5.6.2 in /Users/thiago/anaconda/lib

使用Qt 5.6.2 in / user /thiago/anaconda/lib。

#5


2  

If you can find where Qt's headers are installed, qglobal.h contains a define for QT_VERSION_STR. You can simply grep for that.

如果您能找到Qt的头安装在哪里,qglobal。h包含QT_VERSION_STR的定义。你可以用grep来表示。

#6


1  

cd to the include directory where your qt headers are located and then...

cd到包含qt头的目录,然后…

grep --include=\*.h -rnw ./ -e "QT_VERSION_STR"

which should output something like...

它应该输出诸如…

./QtCore/qglobal.h:40:#define QT_VERSION_STR "5.4.2"

/ QtCore / qglobal。h:40:# define QT_VERSION_STR“5.4.2”