Search code examples
c++qtmathqtcoreqt5.1

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.

Here's Qt's website about QtMath:

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

How do I QtMath, or what have I done wrong?


Solution

  • I added these functions in 5.1, so you cannot use them in 5.0.2. See the documentation note about in each corresponding section:

    This function was introduced in QtCore 5.1.

    Here is the corresponding Gerrit change:

    Add qDegreesToRadians and qRadiansToDegrees math functions

    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:

    #if 0
    #pragma qt_class(QtMath)
    #endif