[Qt-interest] Defining large QMap

Andre Somers andre at familiesomers.nl
Tue Nov 2 08:35:52 CET 2010


Op 2-11-2010 8:27, yogesh upreti schreef:
> Hello Andre,
> Thanks for reply. I am using a similier approach, but I don't want to 
> give that ASCII file to user of software. Is there a way to have it as 
> a Binary file?
It doesn't  need to be ASCII (or any other kind of .txt file). If you 
use QDataStream, it is a binairy file. The only problem is that you'll 
have to make a small application to write out the file in the first 
place. That is very simple, but still.
> How is the method you say about using resourse file? I use that for 
> images and icons but never for Maps.
Of course. You can put any file in a resource and compile that in. It is 
not limited to icons or other images. It works the same way.

André

> Thanks
> Yogesh Upreti
>
>
>     Message: 4
>     Date: Mon, 01 Nov 2010 07:37:09 +0100
>     From: Andre Somers <andre at familiesomers.nl
>     <mailto:andre at familiesomers.nl>>
>     Subject: Re: [Qt-interest] Defining large QMap
>     To: qt-interest at trolltech.com <mailto:qt-interest at trolltech.com>
>     Message-ID: <4CCE6015.9000900 at familiesomers.nl
>     <mailto:4CCE6015.9000900 at familiesomers.nl>>
>     Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>     Op 31-10-2010 23:50, yogesh upreti schreef:
>     > Hello Group,
>     > I need a bit help. What is a good method of defining a big Map.
>     > I have around 150 key pair value. Do I have to declare the map and
>     > define each element one by one or there is a elegant way of
>     doing this??
>     >
>     Basically, yes, you have to do it one by one. However, you don't
>     need to
>     put a huge hardcoded list of QMap::insert statements in your code, of
>     course. I usually use a file with the data, either compiled in as a
>     resource or externally, and load that in. You could even use a
>     QDataStream to load the whole map in one go, but that means making
>     sure
>     that your input data is in the right format.
>
>     Andr?
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101102/b0509a52/attachment.html 


More information about the Qt-interest-old mailing list