diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-01-15 23:48:52 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-01-18 01:31:33 +0100 |
commit | 9ffcab65629539c0335c78d9896153d9c31f475e (patch) | |
tree | 5276bfbe28dc2dcb5db1eba15051adf370ebfc32 /src/corelib/doc | |
parent | 1a440e557b0efa9758f7d41112f09016ad385bab (diff) |
QVersionNumber: port fromString() to QAnyStringView
We can handle the UTF-8 case by reinterpreting it as Latin-1.
This way, the suffixIndex stays valid as a return value.
As a drive-by, optimize away toLatin1() calls by using a QVLA.
We really need a better way of converting UTF-16 -> L1 than
qt_to_latin1()...
[ChangeLog][QtCore][QVersionNumber] fromString() now takes
QAnyStringView (was: QString, QStringView, QLatin1String)
and a qsizetype pointer (was: int pointer).
Change-Id: I86abaadba2792658fbf93ccd1e0b86e3302c697c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/doc')
-rw-r--r-- | src/corelib/doc/snippets/qversionnumber/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/doc/snippets/qversionnumber/main.cpp b/src/corelib/doc/snippets/qversionnumber/main.cpp index 27b7b1a7ef..1a520a1cef 100644 --- a/src/corelib/doc/snippets/qversionnumber/main.cpp +++ b/src/corelib/doc/snippets/qversionnumber/main.cpp @@ -90,7 +90,7 @@ void QObject::parse() { //! [3] QString string("5.4.0-alpha"); - int suffixIndex; + qsizetype suffixIndex; QVersionNumber version = QVersionNumber::fromString(string, &suffixIndex); // version is 5.4.0 // suffixIndex is 5 @@ -98,7 +98,7 @@ void QObject::parse() //! [3-latin1-1] QLatin1String string("5.4.0-alpha"); - int suffixIndex; + qsizetype suffixIndex; auto version = QVersionNumber::fromString(string, &suffixIndex); // version is 5.4.0 // suffixIndex is 5 |