PDA

View Full Version : A problem about Model/view programming



calmspeaker
11th June 2009, 14:35
Hi all!
Firstly, I should say thank you to Model/View arcitecture in Qt for the time it has saved.

Then I have a problem disturb me long time. The tableview in my program has a model which is QSortFilterProxyModel. It serves to sort and filter the data supplied by the source model. The source model hold the data which would change from time to time.
The requirement is : only demonstrate the first 3 rows of the sorted and filtered data!

Please give me a clue! I just donnot know where to start!

Lykurg
11th June 2009, 15:07
... filtered data!

Please give me a clue! I just donnot know where to start!

How do you filter the data. You could there easily implement a 3 "item" limit.

If not you have to use QTableView::hideRow(), which is not very elegant.

calmspeaker
13th June 2009, 05:00
How do you filter the data. You could there easily implement a 3 "item" limit.

The 3 items is the first 3 items of the sorted and filtered data! Could it be implemented in the proxymodel?I cannot figure it out!


If not you have to use QTableView::hideRow(), which is not very elegant.
In Qt source code, QTableView::hideRow() actually use
QHeaderView::resizeSection().The efficient is low for the large data.So it is not going.