|
|
My derived proxy DID NOT implement the map to/from source, I let the base proxy
class do it.
Then I had to derive from the selection model.
I reimplemented the index based virtual functions/public slots so that they
would take in an index map it to the source if necessary, and call the base
function.
You can test if you need to map to a source, with getting the model off the
index with model() and qobject_casting to a proxy model....
BTW< there was a discussion 2 weeks ago about a similar problem with proxy
models.
Scott
-----Original Message-----
From: Michael Möllney [mailto:m.moellney@xxxxxxxxxxxxxxx]
Sent: Friday, June 23, 2006 10:29 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: Selection with a QSortFilterProxyModel between a Model and a View.
Sorry to reply to my own post.... but it was a little confusing.
Michael Möllney wrote:
> Hi Trolls.
>
> Learning to use QAbstractProxyModel I tried to find out how selections
> runs trough the Proxy.
>
> I have:
>
> MODEL connected to VIEW (TreeView)
>
> and same
>
> MODEL connected to PROXY connected to OTHER VIEW (Table)
>
> Showing the information on VIEW and on OTHER VIEW works.
>
> Now I wanted to use the selection on both views to by in sync.
> Therefore I called
> OTHER VIEW . setSelectionModel ( VIEW . selectionModel() )
> But the selection is not in sync.
>
I first started with QAbstractProxyModel and so :
> Surely I implemented (pure abstract as they are) the proxy methods:
> mapFromSource(...)
> mapToSource(...)
> but these methods are _never_ called in the selection process.
>
> I found that the generic implementation in QAbstractProxyModel:
> mapSelectionFromSource(...)
> mapSelectionToSource(...)
> are calling these methods, but I did not found a place in QT where these
> methods are called from a view.
>
I don't see, that you need this two methods (mapFromSource(...) and
mapToSource(...) for QAbstractProxyModel.
> Has anyone a clue for me, how I can tell the standard view to use
> selection syncing with the use of Proxies?
>
> Kind regards,
> Michael
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/
|
|