[Development] Requesting a break in behavior in QML Text element
Mathias Hasselmann
mathias at taschenorakel.de
Fri Jan 30 08:51:35 CET 2015
Am 30.01.2015 um 08:12 schrieb Bo Thorsen:
> Den 29-01-2015 kl. 23:24 skrev Robin Burchell:
>> Hi,
>>
>> Rationale: Text.AutoFormat is a terrible misfeature in almost every
>> case out there.
>> [...]
>
> I agree that it would be better to set plain text as the default. In
> most cases it's what there is in the Text elements anyway. This is at
> least the case for most applications I have come across.
>
> But we can't do this before 6.0. It's a clear API change that will
> affect every single QML application with rich text in Text elements,
> where they don't explicitly set the format. And why would anyone set it
> if they accept rich text? AutoFormat is superior to plain text in that
> it can accept plain text as well.
>
> We would not accept such a change for QWidget based classes, so we can't
> accept it for QML elements either.
Sorry, but that's nonsense.
With QML we can as we have versioned import statements. They are made
exactly for cases like this, incompatible API changes: If the proposed
change only gets implemented for "import QtQuick 2.5" all existing
applications will keep running as they'll import QtQuick 2.4 at maximum.
Also if you rely on that textFormat = Text.AutoText but still want to
upgrade to QtQuick 2.5 its trival to introduce a custom text component
AutoText.qml:
import QtQuick 2.5
Text { textFormat: Text.AutoText }
And then do a trivial search and replace for all Text components:
find -type f -name \*.qml | xargs sed -i -e 's/\<Text\>/AutoText/g'
Costs you less than a minute. After that quick fix you can gradually
upgrade your application to the 2.5 version of QtQuick.Text. Well, or
you just stay with your custom AutoText component. You'll most probably
have it anyway already for custom styling.
Ciao,
Mathias
More information about the Development
mailing list