Revamp Local Fortune Client Example: Create QString instead of char *

Create QString at compile time using the literal operator""s instead of
using pointer to characters. This way, no conversion or allocation will
occur at runtime.

Task-number: QTBUG-117036
Pick-to: 6.5
Change-Id: I9942ef8efa38de9ac5975799249a65fcb4c966c9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit badb0818f5116e19de9bdb6f6b2e0c3e0fa7da99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Rym Bouabid 2023-09-13 17:26:54 +02:00 committed by Qt Cherry-pick Bot
parent 0f9b8e1641
commit 0098309003

View File

@ -9,9 +9,11 @@
#include <QMessageBox>
#include <QTimer>
using namespace Qt::StringLiterals;
Client::Client(QWidget *parent)
: QDialog(parent),
hostLineEdit(new QLineEdit("fortune")),
hostLineEdit(new QLineEdit(u"fortune"_s)),
getFortuneButton(new QPushButton(tr("Get Fortune"))),
statusLabel(new QLabel(tr("This examples requires that you run the "
"Local Fortune Server example as well."))),