[Qt 6.12] Deprecation of QString in 6.12.0 and complete removal in 6.12.1.4.1
-
TL;DR:
QStringdeprecated in 6.12.0 and removed in 6.12.1.4.1Summary
In the long tradition of improving Qtâs stringâhandling robustness and eliminating unnecessary heap traffic wherever possible, we are taking the next logical step in the evolution of Qt APIs:
QStringwill be deprecated in Qt 6.12.0 and scheduled for complete removal in Qt 6.12.1.4.1
This change has been a long time coming. In fact, several of us remember the hallway conversations going back to 2008, predicting the unavoidable sunset ofQString. At the time, this was dismissed as academic speculation. But with the proliferation of stringâview types in Qt 6, the ecosystem is finally ready.Rationale
As everyone who has followed Qtâs architecture work over the years knows,
QStringhas historically been the primary source of:- silent heap allocations,
- sharedâdata aliasing footguns,
- UTFâ16 monoculture,
- and the false security that a string class could ever be both âeasy to useâ and âcorrectâ.
The new design philosophy is simple:
Every string is a view, and every view can be viewed differently.To that end, we are delighted to promote the increasingly mature family of modern C++âcompatible stringâview types, including but absolutely not limited to:
QStringView QLatin1StringView QConstLatin1StringView QUtf8StringView QAnyAprilStringView QTranscendentStringView QPossiblyDanglingButDefinitelyNotOwnedView QTerseYetHyperSpecificStringView QNonOwningCharacterRangeOfUnclearLifetimeView QOverView...and, starting in 6.12, the new
QViewOfAViewOfAView, providing an overview over aQStringViewover aQByteArrayViewover an implementation detail I don't even remotely understand. My only code comment (requiring to add an autotest) caused a shit storm.All of these share one important characteristic:
They do not own memory. Whether you own the memory is, of course, your own responsibility.
This aligns with longâstanding architectural recommendations from an undisclosed colleague, who has consistently reminded us that if anything touches the heap, it is already too late.Acknowledgements
A special thankâyou to @Mike-Trahearn-0, who has for many years been a leading advocate of stringless frameworks. His internal writeâup, âIf you need to print text, you already made a design mistakeâ, has been inspirational to many of us.
On a personal note as a double bass player, Iâve always consideredQStringproblematic at the conceptual level: I prefer[E|A|D|G]String. Strings that actually exist on an instrument â unlikeQString, which, as far as I can tell, neither electric bass, upright bass, nor any orchestral string instrument has ever implemented. Let's not descend into the abyss ofBString(akaHString), used by5Stringbasses. IMHO this evil should have been deprecated before its invention.Migration Plan
Starting in Qt 6.12.0:
Using
QStringwill trigger a deprecation warning narrowing the 47 recommended stringâview variants down to a maximum of 16 (0x10).
Which one is recommended depends entirely on context, encoding, meteorological patterns, phase of the moon and, of course yourCMakeversion.Starting in Qt 6.12.1.4.1:
QStringwill be removed.
Code referencing it will fail to compile with a diagnostic explaining that text output is discouraged.
Qt::NoStringsAttachedbecomes the default build mode.Frequently anticipated questions (A&Q)
Q: Why now?
A: Because we can.
Q: Will it break my application?
A: Only the parts using
QString(raughly 98%).Q: Which string view class suits my use case best?
A: Yes.
Q: Do you provide migration tooling?
We will provide
QStringCutterthat replaces all occurrences ofQStringwith one of the recommended views (see illustration below).Q: Are you serious?
Check this simple snippet. If it compiles and prints output, you are ready to go.
if (QDate::currentDate() == QDate(2026, 4, 1)) qInfo() << "Relax. It's an April Fools' prank. QString is safe.";Yours stringcerely,
Axel Spörl
QStringCutterv0beta1 design flow chart:

-
TL;DR:
QStringdeprecated in 6.12.0 and removed in 6.12.1.4.1Summary
In the long tradition of improving Qtâs stringâhandling robustness and eliminating unnecessary heap traffic wherever possible, we are taking the next logical step in the evolution of Qt APIs:
QStringwill be deprecated in Qt 6.12.0 and scheduled for complete removal in Qt 6.12.1.4.1
This change has been a long time coming. In fact, several of us remember the hallway conversations going back to 2008, predicting the unavoidable sunset ofQString. At the time, this was dismissed as academic speculation. But with the proliferation of stringâview types in Qt 6, the ecosystem is finally ready.Rationale
As everyone who has followed Qtâs architecture work over the years knows,
QStringhas historically been the primary source of:- silent heap allocations,
- sharedâdata aliasing footguns,
- UTFâ16 monoculture,
- and the false security that a string class could ever be both âeasy to useâ and âcorrectâ.
The new design philosophy is simple:
Every string is a view, and every view can be viewed differently.To that end, we are delighted to promote the increasingly mature family of modern C++âcompatible stringâview types, including but absolutely not limited to:
QStringView QLatin1StringView QConstLatin1StringView QUtf8StringView QAnyAprilStringView QTranscendentStringView QPossiblyDanglingButDefinitelyNotOwnedView QTerseYetHyperSpecificStringView QNonOwningCharacterRangeOfUnclearLifetimeView QOverView...and, starting in 6.12, the new
QViewOfAViewOfAView, providing an overview over aQStringViewover aQByteArrayViewover an implementation detail I don't even remotely understand. My only code comment (requiring to add an autotest) caused a shit storm.All of these share one important characteristic:
They do not own memory. Whether you own the memory is, of course, your own responsibility.
This aligns with longâstanding architectural recommendations from an undisclosed colleague, who has consistently reminded us that if anything touches the heap, it is already too late.Acknowledgements
A special thankâyou to @Mike-Trahearn-0, who has for many years been a leading advocate of stringless frameworks. His internal writeâup, âIf you need to print text, you already made a design mistakeâ, has been inspirational to many of us.
On a personal note as a double bass player, Iâve always consideredQStringproblematic at the conceptual level: I prefer[E|A|D|G]String. Strings that actually exist on an instrument â unlikeQString, which, as far as I can tell, neither electric bass, upright bass, nor any orchestral string instrument has ever implemented. Let's not descend into the abyss ofBString(akaHString), used by5Stringbasses. IMHO this evil should have been deprecated before its invention.Migration Plan
Starting in Qt 6.12.0:
Using
QStringwill trigger a deprecation warning narrowing the 47 recommended stringâview variants down to a maximum of 16 (0x10).
Which one is recommended depends entirely on context, encoding, meteorological patterns, phase of the moon and, of course yourCMakeversion.Starting in Qt 6.12.1.4.1:
QStringwill be removed.
Code referencing it will fail to compile with a diagnostic explaining that text output is discouraged.
Qt::NoStringsAttachedbecomes the default build mode.Frequently anticipated questions (A&Q)
Q: Why now?
A: Because we can.
Q: Will it break my application?
A: Only the parts using
QString(raughly 98%).Q: Which string view class suits my use case best?
A: Yes.
Q: Do you provide migration tooling?
We will provide
QStringCutterthat replaces all occurrences ofQStringwith one of the recommended views (see illustration below).Q: Are you serious?
Check this simple snippet. If it compiles and prints output, you are ready to go.
if (QDate::currentDate() == QDate(2026, 4, 1)) qInfo() << "Relax. It's an April Fools' prank. QString is safe.";Yours stringcerely,
Axel Spörl
QStringCutterv0beta1 design flow chart:

@Axel-Spoerl Didn't like the look of the title when I first espied it!
-
Ha, good one! Of course QString needs to go :D I propose to replace it with AiString which just automatically knows what data it should hold based on the context.
The only downside is when servers are down or the model starts hallucinating, but it is only a minor annoyance. -
and the false security that a string class could ever be both âeasy to useâ and âcorrectâ.
That made my day :)
-
and complete removal in 6.12.1.4.1
I could not believe they would remove it in a minor, minor release! :)
@JonB That is, as always with Jon, a strong argument.
We have decided to pause the initiative for a year. -
A Axel Spoerl has marked this topic as solved
-
@JonB That is, as always with Jon, a strong argument.
We have decided to pause the initiative for a year.@Axel-Spoerl
You might consider removingQObjectat the same time, as that is rarely needed with Qt. -
@Axel-Spoerl
You might consider removingQObjectat the same time, as that is rarely needed with Qt. -
My life is now complete, as I have seen my first "A&Q"
Well done. A pattern I will strive to emulate in future (seasonal) announcements. đ«¶