Revamp Mandelbrot example: Use a Literal operator to create QString

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

Task-number: QTBUG-108861
Change-Id: I4fb51d74abbbfa08fb9fddfa90d8afcebd82a7e2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ae0d545d31b480ca65e93e5af5f4649caabaa683)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 364c409e9fe1a22dcd3e6a48991e9ff1cf28ab4f)
This commit is contained in:
Rym Bouabid 2023-09-06 16:51:23 +02:00 committed by Qt Cherry-pick Bot
parent f45b0d08bf
commit 5950bc71a1

View File

@ -9,16 +9,18 @@
#include <QCommandLineOption>
#include <QDebug>
using namespace Qt::StringLiterals;
//! [0]
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription("Qt Mandelbrot Example");
parser.setApplicationDescription(u"Qt Mandelbrot Example"_s);
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption passesOption("passes", "Number of passes (1-8)", "passes");
QCommandLineOption passesOption(u"passes"_s, u"Number of passes (1-8)"_s, u"passes"_s);
parser.addOption(passesOption);
parser.process(app);