Hmm, no acabo de entedre perquè però segons la gent del glibc per defecte
s'ometen els . al fer comparacions de cadenes de caràcters. Alguna idea?
Valeeeeeee, el problema no rau en Qt sinó en glibc i/o
el locale, mireu el
programa adjunt i el seu resultat
unit.cpp unitdescriptor.cpp -1
unitdescriptor.cpp unit.cpp 1
unit.h unitdescriptor.cpp 4
unitdescriptor.cpp unit.h -4
No pot ser que unit.cpp sigui més petit que unitdescriptor.cpp i que unit.h
sigui més gran que unitdescriptor.cpp. Tots dos haurien de ser o més petits
o més grans, però no una cosa cada un.
Informaré a la gent de glibc a veure que diuen
A Diumenge 11 Gener 2004 20:59, Albert Astals Cid va escriure:
> A Diumenge 11 Gener 2004 10:20, Jordi Mas va escriure:
> > > El curiós es que el resultat abans de crear la QApplication es
> > > correcte, però després no ho es
> > >
> > > $ LC_ALL=ca_ES ./test5
> > > Before creating a QApplication
> > > unit.h unitdescriptor.cpp -1
> > > unitdescriptor.cpp unit.h 1
> > > After creating a QApplication
> > > unit.h unitdescriptor.cpp 4
> > > unitdescriptor.cpp unit.h -4
> > >
> > > però el més curiós encara es que si li dic que usi el locale C (sense
> > > cap locale) no falla
> > > Algú te la menor idea de perquè pot passar això?
> >
> > La class QApplication com a part del procés d'inicialització deu trucar
> > a setlocale i canviar el paràmetre, entre d'altres, LC_COLLATE.
> > Veure[1], 'Changes that might affect runtime behavior'.
> >
> > S'hauria de mirar que fa l'objecte aquest de les QT i en quines
> > condicions truca setlocale. Jo no tinc el codi font aquí i no puc
> > mirar-ho.
> >
> > De totes maneres, si fas servir un framework jo sóc partidari de fer
> > servir totes les seves eines i fer servir només la libc quan no hi
> > hagui més opció. Mira't també: QString::compare.
>
> El 'petit' problema es que la implementació de
> QString::localeAwareCompare() usa directament strcoll quan el Qt es
> compila en una plataforma X11, per tant el problema és el mateix.
> QString::compare() no està recomanat per les interfícies ja que no té en
> compte les peculiaritats del locale.
>
> Investigaré més a fons les crides que va QApplication sobre setlocale,
> etc.
>
> Albert.
>
> _______________________________________________
> llista de correu ca
> ca(a)dodds.net
>
http://lists.dodds.net/listinfo/ca