I tend to use a define in .pro file:
# MMmmPP
# MM = major, mm = minor, PP = patch
DEFINES += MYAPP_VERSION=0x031201
.
arg((MYAPP_VERSION
& 0xFF0000
) >>
16,
2,
16,
QChar('0')) .
arg((MYAPP_VERSION
& 0x00FF00
) >>
8,
2,
16,
QChar('0')) .
arg((MYAPP_VERSION
& 0x0000FF
),
2,
16,
QChar('0'));
// "03.12.01"
QString version = QString("%1.%2.%3")
.arg((MYAPP_VERSION & 0xFF0000) >> 16, 2, 16, QChar('0'))
.arg((MYAPP_VERSION & 0x00FF00) >> 8, 2, 16, QChar('0'))
.arg((MYAPP_VERSION & 0x0000FF), 2, 16, QChar('0')); // "03.12.01"
To copy to clipboard, switch view to plain text mode
Bookmarks