[SOLVED] QT_VERSION result to QString



  • When accessing a plugin's metadata via QPluginLoader I can also check for Qt version it was compiled with:

    @
    QPluginLoader loader("somePlugin.dll");
    qDebug() << loader.metaData().value("version");
    @

    that yields something like this:

    @
    328704
    @

    although the documentation specified it should be more like:

    @
    0x050400 (for cute 5.4.0)
    @

    In the application the

    @
    QT_VERSION
    @

    expands to the same result as the number in the plugin. There is no need to compare those because Qt takes care of it when instantiating the object in QPluginLoader. However it would be nice if it could be displayed to the user as well especially if there is a version mismatch.

    How do I convert the number that is result of both plugin's metadata and QT_VERSION into the human readable version number that is result of qVersion() or QT_VERSION_STR?


  • Lifetime Qt Champion

    Hi,

    328704 is base 16 for 0x050400. You can convert that with QString::number(inValue, 16) and go from there.



  • [quote author="SGaist" date="1418590371"]Hi,

    328704 is base 16 for 0x050400. You can convert that with QString::number(inValue, 16) and go from there. [/quote]

    Thank you! Exactly what I needed. :-)


  • Lifetime Qt Champion

    You're welcome !

    Since you have the correct number now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.