Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QT_VERSION result to QString
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QT_VERSION result to QString

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Resurrection
    wrote on last edited by
    #1

    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?

    Secrets are power.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Resurrection
        wrote on last edited by
        #3

        [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. :-)

        Secrets are power.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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 :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved