Re: [Interest] Customzie Qtablemodel and selectionmodel.

2020-06-17 Thread Giuseppe D'Angelo via Interest

Il 17/06/20 07:49, Milos Top ha scritto:

But I can not implement "SelectionModel" on this model.
For example, I want to select first record and last record.
For now, If I select the first record and scroll to down then, I can not 
keep selections because the model is changed by scrolling.


How is the model changed by scrolling, exactly?

The issue with selection is that you need an valid index representing 
the last entry. So, you may lazy load the model data (based on views' 
requests), but the row count has to be accurate immediately. More than 
doable, anyhow.


My 2 c,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Customzie Qtablemodel and selectionmodel.

2020-06-17 Thread Jonathan Purol
> How can I solve this issue efficiently?
> Or is there another way to load a list with hundreds of thousands of
> records instantly?
Take a look at https://doc.qt.io/qt-5/qabstractitemmodel.html#fetchMore
and https://doc.qt.io/qt-5/qabstractitemmodel.html#canFetchMore. They
let you load items lazily into a view.

Best Regards,
Jonathan Purol
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] Customzie Qtablemodel and selectionmodel.

2020-06-16 Thread Milos Top
Hi.
I love Qt.
These days I have been working on Qt project with 5.15 of version.
Here I have one issue on QTableView/Model.
 I have a playlist with hundreds of thousands of records. Each record has 100+ 
fields.
It takes a little time to load all of the playlists fully.
But my client wants me to load it instantly So I tried with custom model and 
scroll bar.
What I tried is to load only visible records instead of loading all records.
So the model is changed by SQL Query (ex: "Select * from t_list Order by name 
asc limit 30, 100") when scrolling.
Everything is good.
But I can not implement "SelectionModel" on this model.
For example, I want to select first record and last record.
For now, If I select the first record and scroll to down then, I can not keep 
selections because the model is changed by scrolling.

How can I solve this issue efficiently?
Or is there another way to load a list with hundreds of thousands of records 
instantly?

Please reply me kindly.

Best regards,
Milos.
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest