[Qt-interest] Different Selections buit same Model?
André Somers
andre at familiesomers.nl
Sat Jan 23 16:19:59 CET 2010
Or you just set the selection model of one of your views to be the selection
model for the other view(s) too.
Just call view_1->setSelectionModel(view_2->selectionModel());
Of course, if your views have a different life expectancy, you're in trouble
in this setup...
André
-----Oorspronkelijk bericht-----
Van: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Namens Sean Harmer
Verzonden: vrijdag 22 januari 2010 17:59
Aan: qt-interest at trolltech.com
Onderwerp: Re: [Qt-interest] Different Selections buit same Model?
Hi,
On Friday 22 January 2010 16:54:14 Eric Clark wrote:
> Oh, then I guess that means that if I want to share the selections, that
is
> when I need to do something, yes?
Yes create a QSelectionModel and set it on your views with:
void QAbstractItemView::setSelectionModel ( QItemSelectionModel *
selectionModel )
This allows you to share selection models across all of your views if you so
wish. Note that you are responsible for deleting it when no longer needed.
ATB,
Sean
>
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Scott Aron Bloom
> Sent: Friday, January 22, 2010 10:48 AM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Different Selections buit same Model?
>
> The selection model is associated with the view.. There is nothing for you
> to do.
>
>
> Scott
>
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Eric Clark Sent:
> Friday, January 22, 2010 8:41 AM
> To: Qt Interest (qt-interest at trolltech.com)
> Subject: [Qt-interest] Different Selections buit same Model?
>
> Hello All,
>
> I know that I read in the documentation, at one point in time, that it is
> possible to have multiple views share the same model, but not the same
> selection model. Is this correct? I cannot seem to find where I read it
in
> the documentation. If it is possible, could someone please tell me how to
> do it?
>
> Thanks,
> Eric
>
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list