[Qt-interest] QTreeView, proxy model and expandable state

Dmitry Baryshev ksquirrel.iv at gmail.com
Mon Apr 13 17:34:36 CEST 2009


2009/4/13 Scott Aron Bloom <Scott.Bloom at sabgroup.com>:
> It will really depend on what you implemented in your filterAcceptsRows
> method.
>
> Without seeing the guts of it, I have no idea how to help you.
>
> Scott
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Dmitry Baryshev
> Sent: Monday, April 13, 2009 8:26 AM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] QTreeView, proxy model and expandable state
>
> Hi.
>
> I use QTreeView+QFileSystemModel. It seems to work fine, all directory
> items have expanable flag ("+" on the left side). Now I've added
> QSortFilterProxyModel with only one reimplemented method - "bool
> SortFilterProxyModel::filterAcceptsRow(int row, const QModelIndex
> &parent) const". Now all directory items in QTreeView lost its
> expandable state - no '+' elements.
> QTreeView::setItemsExpandable(true) doesn't help. I don't understand
> the logic why filtering affects expandable states? Could you please
> help me with this strange problem? Thanks!
>
> --
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>

In any case it doesn't work. For example:

bool MySortFilterProxyModel::filterAcceptsRow(int row, const
QModelIndex &parent) const
{
    return true;
}

--



More information about the Qt-interest-old mailing list