How to use ICU with QT sql
-
Hi,
I am working on an application where I have created our database using QTsql
and Sqlite.
Now I want to sort the data in the tables and this sorting should support
all the languages like English, Chinese, Korean etc.So i found ICU as a useful tool to solve my purpose. But I don't know how to
use ICU with QTsql queries.Will you please tell me how to do this?
Thanks in Advance
Abhi -
ICU is indeed a great unicode library, but most of the stuff it does is build into Qt already. So if you are not using some really exotic sorting behaviour you might be able to get away with "QString::localeAwareCompare(...)":http://doc.qt.nokia.com/latest/qstring.html#localeAwareCompare.
To use ICU you need to define conversion operators between QString and the strings used by ICU. You might want to work with QByteArrays wherever possible to store the raw ICU strings as a sequence of bytes to avoid the conversation overhead.
-
Hi Tobias,
Thanks for you reply.
Would help a bit more. Actually I am very new to QT, So it would be a great help to me if you can provide some example of how to sort a sqlite database table using Qstring::localeAwareCompare.Thanks in Advance
Abhi -
[quote author="abhi.dhiman83" date="1293091323"]Hi Tobias,
Thanks for you reply.
Would help a bit more. Actually I am very new to QT, So it would be a great help to me if you can provide some example of how to sort a sqlite database table using Qstring::localeAwareCompare.Thanks in Advance
Abhi[/quote]Abhi,
Its Qt and not QT.