Hello,

What is the currently recommended way to concatenate several QStrings and/or 
string literals? Take this code as an example:


QImage img;

QString getProjectDir();

// ...



QString basename = QFileInfo(imgPath).baseName();

QString thumbPath = getProjectDir() + "/thumb_" + basename + ".jpg";

img.save(thumbPath);


I found several blog posts and wiki articles recommending one or multiple of:


1.       QStringLiteral

2.       QLatin1String

3.       QStringBuilder

4.       Simple string literals

Since this may have changed over time, what do current best practices say?

Best regards,
Julius

[1]: http://blog.qt.io/blog/2014/06/13/qt-weekly-13-qstringliteral/
[1] and [2]: http://woboq.com/blog/qstringliteral.html
[3:] https://wiki.qt.io/Using_QString_Effectively and
        
http://blog.qt.io/blog/2011/06/13/string-concatenation-with-qstringbuilder/

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to