diff options
author | Rym Bouabid <rym.bouabid@qt.io> | 2023-09-13 17:26:54 +0200 |
---|---|---|
committer | Rym Bouabid <rym.bouabid@qt.io> | 2023-09-20 20:36:31 +0200 |
commit | badb0818f5116e19de9bdb6f6b2e0c3e0fa7da99 (patch) | |
tree | 12b5e931492458504fa7a13ff8bd098753b40ee4 /examples/corelib | |
parent | b83736be05e8ba4bcc586ff276ce81f992e0ef76 (diff) |
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.6 6.5
Change-Id: I9942ef8efa38de9ac5975799249a65fcb4c966c9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'examples/corelib')
-rw-r--r-- | examples/corelib/ipc/localfortuneclient/client.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/corelib/ipc/localfortuneclient/client.cpp b/examples/corelib/ipc/localfortuneclient/client.cpp index 44981400d0..dcc7e0f0c2 100644 --- a/examples/corelib/ipc/localfortuneclient/client.cpp +++ b/examples/corelib/ipc/localfortuneclient/client.cpp @@ -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."))), |