Qt is a powerful cross-platform C++ framework widely used for developing graphical user interfaces (GUIs) and applications. Whether you're a seasoned Qt developer or just getting started, knowing the Qt version the application is using is essential for compatibility and debugging. This tutorial shows how to get Qt version using C++.
In the provided code snippet, we retrieve the Qt version information as a string and store it in a variable. Next, the obtained version is presented on the console.
#include <QtGlobal>
#include <iostream>
int main()
{
std::string version = QT_VERSION_STR;
std::cout << version << std::endl;
return 0;
}
The version follows the format of major.minor.revision
. An example of the resulting output is provided below:
6.6.1
Leave a Comment
Cancel reply