Important: Please read the Qt Code of Conduct -


  • This may be a newbie question. If so I do apologize.

    But, is there a way to automatically advance the value of Q_VER_PAT on each compile? Or is it totally manual by editing the script file or .pro

  • Lifetime Qt Champion


    No there's not, that's typically something that you set when you will do a patch release which is outside of the build/rebuild cycle.

    Usually you would add a build number if you want to provide more information about than the classic Major/Minor/Patch versioning.

  • @SGaist that is good to know. I am familiar with the build number. Several build-from-src packages I use have it.

    So, add a build number to what?
    Are you referring to the .pro file or a display of the version of the app? What did you have in mind?
    Are you inferring that the build number is one that can be incremented when the build has been compiled and linked by QtCreator as a package?

  • Lifetime Qt Champion

    What I have in mind is rather one that is based on your version control status. Something that allows you to get back to the exact commit that was used to build the exec.

  • @SGaist
    Yes, I know all that. It can be done manually.

    But, that does not answer my questions. Please address the questions relevant to QtCreator and my project.

    There is almost no mention of the build number aspect in the QMake or QtCreator docs except as a passing thought. I would like more information on how to generate, increment, and programmatically use this number.

    You have considerable experience and knowledge to provide this answer so please do.

  • @ad5xj said in QtCreator Q_VER_MIN Q_VER_PAT:

    Please address the questions relevant to QtCreator and my project.

    This has already been addressed:

    @SGaist said in QtCreator Q_VER_MIN Q_VER_PAT:

    No there's not,

  • Lifetime Qt Champion

    As I already suggested, you can use your version control system to extract the hash of the current commit for example.

    Use the system qmake command for that.

    Then you can use QMAKE_SUBSTITUTES like described in this article to include the information in your library/application.

Log in to reply