From 6dfc3541e67f7c9297310c898d928caabde4e1f4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 25 Apr 2016 23:28:42 -0700 Subject: Add QLibraryInfo::version() returning the Qt version as QVersionNumber [ChangeLog][QtCore][QLibraryInfo] Added QLibraryInfo::version(), which returns the current version of the Qt library as a QVersionNumber object. Change-Id: Ifea6e497f11a461db432ffff1448d4dc84ef57b1 Reviewed-by: Oswald Buddenhagen --- src/corelib/global/qglobal.cpp | 2 +- src/corelib/global/qlibraryinfo.cpp | 13 +++++++++++++ src/corelib/global/qlibraryinfo.h | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 320fe50b4c..012202fe44 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1033,7 +1033,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in example, "4.1.2"). This may be a different version than the version the application was compiled against. - \sa QT_VERSION_STR + \sa QT_VERSION_STR, QLibraryInfo::version() */ const char *qVersion() Q_DECL_NOTHROW diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 458200180e..70e19d1f86 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -366,6 +366,19 @@ QLibraryInfo::isDebugBuild() #endif } +#ifndef QT_BOOTSTRAPPED +/*! + \since 5.8 + Returns the version of the Qt library. + + \sa qVersion() +*/ +QVersionNumber QLibraryInfo::version() Q_DECL_NOTHROW +{ + return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH); +} +#endif // QT_BOOTSTRAPPED + #endif // QT_BUILD_QMAKE /* diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 362d47dea3..a1c146923e 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -42,6 +42,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -63,6 +64,10 @@ public: static bool isDebugBuild(); +#ifndef QT_BOOTSTRAPPED + static QVersionNumber version() Q_DECL_NOTHROW Q_DECL_CONST_FUNCTION; +#endif + enum LibraryLocation { PrefixPath = 0, -- cgit v1.2.3