简体   繁体   English

如何添加/使用 <QtMath> 与Qt 5.0.2

[英]How to add/use <QtMath> with Qt 5.0.2

I have been trying to add <QtMath > to my Qt so I can use qDegreesToRadians and such but when I add #include <QtMath> it says no such file or directory. 我一直试图将<QtMath >添加到我的Qt中,以便可以使用qDegreesToRadians等,但是当我添加#include <QtMath>它说没有这样的文件或目录。

Here's Qt's website about QtMath: 这是Qt关于QtMath的网站:

http://qt-project.org/doc/qt-5.1/qtcore/qtmath.html#details http://qt-project.org/doc/qt-5.1/qtcore/qtmath.html#details

How do I QtMath, or what have I done wrong? 我如何QtMath,或者我做错了什么?

I added these functions in 5.1, so you cannot use them in 5.0.2. 我在5.1中添加了这些功能,因此不能在5.0.2中使用它们。 See the documentation note about in each corresponding section: 请参阅每个相应部分中有关的文档说明:

This function was introduced in QtCore 5.1. 此功能在QtCore 5.1中引入。

Here is the corresponding Gerrit change: 这是相应的Gerrit更改:

Add qDegreesToRadians and qRadiansToDegrees math functions 添加qDegreesToRadians和qRadiansToDegrees数学函数

But #include <QtMath> or #include <QtCore/QtMath> should just work (once you update, for sure) because there are these lines in the source that I added: 但是#include <QtMath>#include <QtCore/QtMath>应该可以正常工作(确保一旦更新),因为我在源代码中添加了以下#include <QtCore/QtMath>行:

#if 0
#pragma qt_class(QtMath)
#endif

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM