Results 1 to 3 of 3

Thread: QStringLiteral between qt4 and qt5

  1. #1

    Default QStringLiteral between qt4 and qt5

    Hello everyone!
    I have a question for you qt coder.
    I am curently working on a qt widget, and I am developing it in two different os (ubuntu and fedora).
    Ubuntu runs on qt5 and fedora on qt4.
    I am trying to make the compilation on both os as smooth as possible.
    So far I was able to achive that by using a couple of macro and variables like
    #if (QT_VERSION < QT_VERSION_CHECK(5 ,0 ,0))
    etc.
    Now qt 5 put in my ui_mainwindow.h the QStringLiteral which is new in qt5. Googling aroung I saw that if the compiler doesnt support c++ 11 the macro will fall back to QString::fromtUtf8.
    My question is whats the best way to maintain backward compatibility?
    Just replacing all QStringLiteral with QString::fromUtf8 or maybe try with a :
    #define QStringLiteral QString::fromUtf8??
    What you think is best?

    Cheers

    M.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QStringLiteral between qt4 and qt5

    That is not an issue here, ui_mainwindow.h is generated by UIC and the Qt4 UIC will not use QStringLiteral.

    Cheers,
    _

  3. #3

    Default Re: QStringLiteral between qt4 and qt5

    Thank you , how can I force the UIC to re-run from qt creator?
    So I can get a new clean ui_mainwindow.h file qt4 compatible?
    I tried to clean and rebuild etc but the ui_mainwindow.h file does not get regenerated


    Added after 43 minutes:


    Alright fixed the problem, desabiling shadow build in the project forced to rebuild the ui_mainwindow.h
    I also paid attention to the :
    ** WARNING! All changes made in this file will be lost when recompiling UI file!

    thanks man
    Last edited by giordi; 8th July 2014 at 13:35.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.