Howto convert QOperatingSystemVersion::current() to string ?
Solved
General and Desktop
-
-
I need a runtime OS name and version. So i used
qDebug() << QOperatingSystemVersion::current();
Which returns
QOperatingSystemVersion("Windows", 10.0.19043)
I need this object to be converted to std::string Or QString like below
Windows-10.0.19043
-
@pingal
I don't know what else to say. Look at the documentation, pick the members you want to include in your string likename()
ormajorVersion()
, and use sayQString::arg()
to format them into the desired string. There is nothing especially "Qt" in accessingQOperatingSystemVersion()
members, it's just like any other class.