[Development] FW: Backwards compatibiltiy break in Qt 5.5

Olivier Goffart olivier at woboq.com
Tue Jul 28 09:37:53 CEST 2015


On Tuesday 28. July 2015 11:47:09 Tasuku Suzuki wrote:
> Hi Thiago,
> 
> 2015-07-28 1:34 GMT+09:00 Thiago Macieira <thiago.macieira at intel.com>:
> > On Monday 27 July 2015 19:27:44 NIkolai Marchenko wrote:
> >> > Or just use qPrintable() around your strings.
> >> 
> >> you do realize, that it will require editing thousands of instances of
> >> qDebug in the old code?
> > 
> > Yes.
> 
> grepped "QDebug\s*&?operator\s*<<\\(QDebug" under qtbase/src, and
> checked if QDebug operator<<(QDebug, const QString&) is used in it for
> strings that can be utf8 very roughly. Do we fix those functions?
> 
> QtCore:
> QDebug operator<<(QDebug debug, const QDir &dir)
> QDebug operator<<(QDebug, const QJsonValue &)
> QDebug operator<<(QDebug, const QVariant &)
> 
> QtSql:
> QDebug operator<<(QDebug dbg, const QSqlDatabase &d)
> QDebug operator<<(QDebug dbg, const QSqlError &s)
> QDebug operator<<(QDebug dbg, const QSqlField &f)
> QDebug operator<<(QDebug dbg, const QSqlRecord &r)
> 
> QtGui:
> QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
> QDebug operator<<(QDebug stream, const QFont &font)
> QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
> 
> QtDBus:
> QDebug operator<<(QDebug, const QDBusError &)
> 
> 
> Qt itself uses QDebug operator<<(QDebug, const QString&) to get
> warning messages useful.
> e.g.
> http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/io/qiodevice.cpp#n83
> Do we apply qPrintable() everywhere in Qt?
> 
> 
> Will it be possible to apply qPrintable() to QString in containers?

This is another very good point is that Qt itself uses operator<< with 
filenames or potentially translated error messages a lot.

More than 4000 usages to check:
http://code.woboq.org/data/symbol.html?root=../qt5&ref=_ZN6QDebuglsERK7QString

Not to mention that qPrintable would only make the problem worse since it 
converts the string to latin1 then interpret it as utf8!
qUtf8Printable should be used instead.

-- 
Olivier 

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org



More information about the Development mailing list