[Interest] Porting to Qt5/macx-xcode Mountain Lion

Joshua Grauman jnfo-c at grauman.com
Fri Jan 25 02:17:21 CET 2013


So looking at qtextcodec.cpp, there is quite a bit of conditionally 
compiled code. For example. if QT_USE_ICU is defined, 
QTextCodec::codecForName() calls QIcuCodec::codecForNameUnlocked(name) 
instead of looking it up itself, and the setup() function won't call 
(void)new QUtf8Codec; Presummably ICU would deal with that then, but maybe 
ICU only gets instantiated when QCoreApplication is called (or the other 
way around). But without being able to see what defines were on when 
Qt/Mac was compiled, that's going to be a tough one to track down. But my 
best guess would be to look at if QT_USE_ICU was defined in 
Linux/Mac/Windows when compiling the SDKs and maybe that would effect when 
QUtf8Codec gets instantiated...

Josh


> Ok, got it. That makes way more sense. Sorry for being slow. I'll take a
> look and let you know if I can find any more information.
>
> Josh
>
>> On quinta-feira, 24 de janeiro de 2013 16.20.37, Joshua Grauman wrote:
>>> I'm not sure I completely understand your question, but I'll give it a
>>> shot. I had a global variable as follows (bad style, I know). It seems
>>> pointless I know, but it's because I also have other custom
>>> implementations of QTextCodec that get instantiated right next to it, so I
>>> just put them all together.
>>>
>>> QTextCodec *Ecodec = QTextCodec::codecForName("UTF-8");
>>>
>>> So since this was a global variable, it gets called before
>>> QCoreApplication, and I'm assuming that's why it returns 0. Does that
>>> help?
>>
>> No, because you had already told me that :-)
>>
>> I know it returns 0. Your hypothesis is that it returns 0 because it was
>> called before QCoreApplication was initialised, which you've been able to
>> prove to be the case. But I looked at the code and, at first glance, there was
>> nothing to indicate why that would be the behaviour.
>>
>> What I want to know is why that behaviour is so. Where, in the code inside Qt,
>> does it make a decision that gets it a null, instead of the proper codec?
>>
>>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



More information about the Interest mailing list