[Development] QLatin1Constant and QtContacts / QtOrganizer

lars.knoll at nokia.com lars.knoll at nokia.com
Tue Dec 20 09:31:22 CET 2011


Great, that's good to hear. I think I've seen it in some other places in
the former Qt Mobility modules as well though.

Cheers,
Lars

On 12/19/11 11:42 PM, "Zhu Xizhi (Nokia-MP/Tampere)" <xizhi.zhu at nokia.com>
wrote:

>Hi,
>
>We're actually removing the usage of QLatin1Constant in QtContacts,
>QtOrganizer, and QtVersit.
>It's copied just as a temporary solution during the modularization of
>these modules.
>
>================
>Xizhi Zhu (Steven)
>
>Software Engineer @ Qt Development Frameworks
>Nokia
>
>Mobile: +358 (0)50 480 1247
>________________________________________
>From: development-bounces+xizhi.zhu=nokia.com at qt-project.org
>[development-bounces+xizhi.zhu=nokia.com at qt-project.org] on behalf of ext
>Mathias Hasselmann [mathias at openismus.com]
>Sent: Tuesday, December 20, 2011 12:08 AM
>To: Knoll Lars (Nokia-MP/Oslo)
>Cc: development at qt-project.org; Rose Todd (Nokia-M/Alpharetta)
>Subject: Re: [Development] QLatin1Constant and QtContacts / QtOrganizer
>
>Am Montag, den 19.12.2011, 19:18 +0000 schrieb lars.knoll at nokia.com:
>> On 12/14/11 11:01 AM, "ext Todd.Rose at nokia.com" <Todd.Rose at nokia.com>
>> wrote:
>>
>> >I'm in the early stages of trying to port a Qt4.7 app that uses
>> >qt-mobility to Qt5.  Today I noticed compile errors caused by the
>> >duplication of qlatin1constant.h in both of these
>> > modules.
>> >
>> >The problem shows when you write an app that uses both the QtContacts
>>and
>> >the QtOrganizer modules.   Headers within the QtContacts module will
>> >sometimes include the QtOrganizer version of qlatin1constant.h (or
>> >vice-versa depending on the app's include path
>> > ordering).  The use of namespaces in these headers is what leads to
>>the
>> >errors.
>> >
>> >There's several solutions, and I guess it'd be best if the
>> >QLatin1Constant functionality was moved to a core library, but until
>>then
>> >can we at least have the headers *within* the Contacts and Organizer
>> >modules include qlatin1constant.h in an unambiguous manner?
>>
>> I'm actually wondering whether this class still makes sense in Qt 5.
>>We've
>> done some changes to QLatin1String to make it more suitable and have
>> QStringLiteral in addition. That should make the need for this class
>> mostly go away IMO.
>
>+1 - QLatin1String is painful to use: You cannot really store references
>to it, you constantly get trouble from C++ not being able to resolve
>which of its cast operators shall be used (QString vs. QLatin1String).
>Also I never really got is purpose: To enable comparison and hashing of
>QtContact's string keys, and to make sure those strings don't waste
>memory on heap, it would have been sufficient to use QString::
>fromRawData() to initialize those constants.
>
>Ciao,
>Mathias
>
>--
>Mathias Hasselmann <mathias at openismus.com>
>http://openismus.com/
>
>_______________________________________________
>Development mailing list
>Development at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/development




More information about the Development mailing list