[Qt-interest] Huge amount of data in tree or whatever(view)
Louai Al-Khanji
louai.khanji at gmail.com
Thu Dec 31 22:56:09 CET 2009
The model/view classes will do much of this for you. In your model,
reimplement rowCount() to return the total number of entries. Your
data() function will then be called for those entries that are
visible.
Depending on your requirements and implementation, you might choose to
do some sort of caching or optimisation, like getting the surrounding
entries at the same time in one request when the data function is
called.
On Thu, Dec 31, 2009 at 4:33 PM, Marek Bronowicki <marek at cyberdeus.pl> wrote:
> Hi Irfan
>
> I mean that in first stage user gets all data from database.
> Selecting 1 500 000 ecords in one time can kill anybody, so my point of view
> is to send a query to scrollbar like "SELECT count(*) FROM table" to gather
> count of all records, and to a view send a query "SELECT * FROM table LIMIT
> %d,50"
> where %d is an int of begin of table.
>
> for example:
> if the scrollbar is on the top the %d = 0
> if the scrollbar is one page down - %d = 51
> etc.
>
>
> Best Wishes for 2010 for you and all QT users and developers,
> Marek Bronowicki
>
> W dniu 2009-12-31 21:32, Irfan Omair pisze:
>
> Hi Marek,
>
> Do you mean even if you slect only 50 Rows from you DB to your table
> veiew/tree view you still see long vertical scrollbar??
> Are you directly pulling and showing to your table veiw?? or Do you pull the
> data from db and storing it in some stringlist and then showing to your
> view?
>
> I had some similar problem issue which got solved when I stored the data
> from db to stringlist and then shown all/few of those to my table depending
> up on the business logic.
>
> Does this helps in any way?
>
> Regards,
> Irfan Omair
>
> On Thu, Dec 31, 2009 at 11:13 AM, Marek Bronowicki <marek at cyberdeus.pl>
> wrote:
>>
>> Hi
>>
>> Perhaps this topic was "blended" and "sqashed" milions of times, but I
>> still cannot find a solution.
>>
>> This is what I need to do:
>> I have one and a half milion of records in SQL database and I need to
>> show them all in some view.
>>
>> What I know already that is that about 40000 records in treeview is a
>> total mass of information for my Athlon X2 2,0 to show and pressing the
>> end key hangs the soft for about 10 seconds to get on the end of the list.
>> My friend told me that this has to be model view, but after inserting
>> the same amount of data to model based view the result is the same.
>>
>> I'm thinking about simple solution that can retrievie only shown rows
>> from the database with scrollbar as huge as the whole table. In example:
>> My treeview or tableview or whateverview has height for 50 rows (let's
>> say 10 px for row so 500px without header bar), so:
>> my select query: "SELECT * FROM table LIMIT 0,50;" and this is shown
>> live on the treeview
>>
>> but vertical scrollbar it's as big as "select * from table"
>>
>> If i will press page down, the select query will change to SELECT * FROM
>> table LIMIT 50,50;
>> the same with down arrow SELECT * FROM table LIMIT 1,50;
>> etc.
>>
>> I don't know if i'm describing it right, or as usual only I'm
>> understanding what I'm writing:-)
>>
>> Best Regards,
>> Marek Bronowicki
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
- Louai Al-Khanji
More information about the Qt-interest-old
mailing list