From the reference it is known that QStringLiteral places the text directly in the executable file in the read-only area. However, I did not find the information that in case of using the same lines in different places of the project code, these lines will be stored according to the uniqueness of the value. Or will each instance of the string be saved separately?
Suppose there is a network request to some external resource. This query has a string command, say, " https://ru.stackoverflow.com/ ". There are also two classes: class A and class B In both, the specified query is required:
class A { void getSo() { sendRequest(QStringLiteral("https://ru.stackoverflow.com/")); // Далее выполняем что-то специфическое для класса A. } }; class B { void getSo() { sendRequest(QStringLiteral("https://ru.stackoverflow.com/")); // Далее выполняем что-то специфическое для класса B. } }; The question is what exactly gets into the executable file: two lines with the address of the request or one? Or do I misunderstand the principle of the specified macro?