[Qt-interest] Responding to when a QSortFilterProxyModel is initialized

Jeffrey Brendecke jwbrendecke at icanetix.com
Mon Sep 27 07:28:41 CEST 2010


I am working on a Model-View-Delegate application that has the following 
characteristics:

* Makes an asynchronous request for information read via the signal slot 
information from an external process. The information is a list of resources 
that are indivudually expensive to retrieve.
* Fills an internal table in the model with that information once fully 
available. Changes to the table are bracketed with beginResetModel() and 
endResetModel(). Actually, the table is cleared and then refilled.
* Sends a signal that the update is complete.
* The QTableView wraps the source model in a QSortFilterProxyModel to allow 
sorting and filtering.

What is supposed to happen next is for the View to make a request to the model 
for the resource that is first in the table and display it in an embedded 
editor. The resource request is made similarly asynchronously and the edit 
area is enabled after the resource has actually been retrieved.

The Problem:
* How does the source model know what is first in the table after the refresh?

It is well documented how to respond to user selection changes in the view, 
but unclear how to know when the QTableView has been initialized with new 
data after a refresh so that a request can be made to actually show the 
resource referenced by the first item in the table after the refresh.

Is this something the model should initiate delivering the resource? It, 
however, does not know what is first item in the table is given the 
QSortFilterProxyModel.

Trying to catch the request in the model's implementation of data() is too 
resource intensive given the volume of requests made on a refresh. As I 
mentioned, it is expensive to actually retrieve the resource.

Thank you very much for any assistance.

Sincerely,

Jeffrey Brendecke

Managing Director
icanetix Software Systems and Consulting GmbH
Untere Hagenstrasse 26
91217 Hersbruck
Germany

Commercial Registry B 25317 Nuremberg, Germany
VAT-ID: DE250213502



More information about the Qt-interest-old mailing list