What's the difference between the two? Which one is best to use?
What's the difference between the two? Which one is best to use?
QString
is a type represents text in Qt. It is the equivalent of type string
of C ++, but they are not compatible. They are stored differently. When using Qt, it is usually more advantageous to apply this type to avoid unnecessary conversions in various situations.
QString variavel("hello world");
The QStringLiteral
is just a macro created from version 5 that creates a literal string compatible with type QString
. Before that, it was done to create a literal string
standard and then a conversion would be done when passing it to a Qt method that expects a Qstring
. This macro avoids this conversion.
if (node.hasAttribute(QStringLiteral("http-contents-length")))
Qt's Portuguese material is quite complicated. Take a look on , but I do not know if it's good.