[SOLVED] Convert #define value to QString?



  • I have the following define in a central .pri file:

    @DEFINES += "TCL_VERSION=0.75"@

    In my program, I would like to output this version, and therefore need to convert the value '0.75' into a QString.

    No obvious way to do that occurred to me. QString(TCL_VERSION) does not compile, and QString("TCL_VERSION") will obviously not do what I want.

    Ideas?



  • You either modify your .pri file and wrap the value correctly with quotes
    @
    DEFINES += TCL_VERSION="\"0.75\""

    QString(TCL_VERSION);
    @
    or you use the preprocessor to do this for you
    @
    #define QUOTE(string) _QUOTE(string)
    #define _QUOTE(string) #string

    QString(QUOTE(TCL_VERSION));
    @



  • Thanks!

    On an unrelated note: Why do I always get
    "Error Message: Unable to receive your submission at this time " whenever I try to just write "Thanks"?



  • [quote author="Asperamanca" date="1329723547"]Thanks!

    On an unrelated note: Why do I always get
    "Error Message: Unable to receive your submission at this time " whenever I try to just write "Thanks"?[/quote]

    Network problem?



  • Nope. It consistently happens when I try to write short answers.



  • I think there is a minimum amount of characters which need to be entered into a post to be accepted (to prevent short bump and spam posts). The error message is just misleading.



  • Additionally, you cannot post a comment that has the very same wording as a comment posted previously. If someone else had posted "Nope. It consistently happens when I try to write short answers." before, you wouldn't have been able to send your comment too.


Log in to reply