I don't think you need to do a full reset. QSortFilter model has a rowsMoved() signal. There is also a layoutChanged() signal whenever the layout changes (e.g. due to sorting).
Kr, Chris. On Wed, Jan 5, 2011 at 12:31 AM, Bartosh Wroblevksy <[email protected]>wrote: > just curious when rows are moved in a proxy model that is sorted, what > sort of an emit do you guys do to signal to the qml window that the model > needs to be updated. Do you guys do a full reset? > > ------------------------------ > From: [email protected] > To: [email protected]; [email protected] > Date: Thu, 30 Dec 2010 02:19:44 -0500 > CC: [email protected] > > Subject: Re: [Qt-qml] QSortFilterProxyModel and QML ListView > > > Thanks guys, it looks like it works if you call sort just once and > set QSortFilterProxyModel::setDynamicSortFilter(true) . > That said, with Qt 4.7.0, I see a comparable behavior as described in the > bug here http://bugreports.qt.nokia.com/browse/QTBUG-13628. So I decided > to go with Qt 4.7.1 and so far, everything works ok. > > Thanks again for the help. > Bartosh > > > ------------------------------ > Date: Wed, 29 Dec 2010 09:31:44 +0200 > Subject: Re: [Qt-qml] QSortFilterProxyModel and QML ListView > From: [email protected] > To: [email protected] > CC: [email protected]; [email protected] > > If you enable dynamic sorting: > QSortFilterProxyModel::setDynamicSortFilter(true) > > then you only need to call sort() once (for example in the constructor) so > that the model knows which way to sort. > Then any time the model changes, the sorting will be automatically updated. > > I personally use QSortFilterModel with QML and it works just fine. > > Kr, > Chris. > > On Wed, Dec 29, 2010 at 6:40 AM, Bartosh Wroblevksy <[email protected]>wrote: > > With QSortFilterProxyModel, it looks like I have to take care of the list > being sorted myself by calling QSortFilterProxyModel::sort(), please tell me > there is a better way. > > > ------------------------------ > From: [email protected] > To: [email protected]; [email protected] > Date: Tue, 28 Dec 2010 23:31:58 -0500 > > Subject: Re: [Qt-qml] QSortFilterProxyModel and QML ListView > > so why is my list not appearing sorted????? I was afraid of this. > > > > To: [email protected] > > From: [email protected] > > Date: Wed, 22 Dec 2010 23:55:02 +0100 > > Subject: Re: [Qt-qml] QSortFilterProxyModel and QML ListView > > > > Bartosh Wroblevksy wrote: > > > > > > > > Hi, > > > I am about to use a QSortFilterProxy model with a QML ListView. I do > not > > > want to end up with nasty surprises. Do QML listViews support Qt's > > > QSortFilterProxy? > > > > Yes. QML uses the QAbstractItemModel API. QML doesn't know or care that > it's > > a proxy. Any custom roles set with setRoleNames on your 'core' model are > > also available through the proxy. > > > > > When items are filtered, can I set animations when they > > > disappear? Thanks, Bartosh > > > > Yes. You can use onAdd and onRemove as before I guess. I don't think I've > > > tried using them with a QAIM before though. > > > > Steve. > > > > _______________________________________________ > > Qt-qml mailing list > > [email protected] > > http://lists.qt.nokia.com/mailman/listinfo/qt-qml > > _______________________________________________ Qt-qml mailing list > [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml > > _______________________________________________ > Qt-qml mailing list > [email protected] > http://lists.qt.nokia.com/mailman/listinfo/qt-qml > > > > _______________________________________________ Qt-qml mailing list > [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml >
_______________________________________________ Qt-qml mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml
