WOrk on correct expand after filtered in.

This commit is contained in:
Martin Rotter 2016-04-30 15:05:14 +02:00
parent eb3f2e0174
commit 011f0979c3
3 changed files with 9 additions and 3 deletions

View File

@ -188,12 +188,15 @@ bool FeedsProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source
if (should_show && m_hiddenIndices.contains(QPair<int,QModelIndex>(source_row, source_parent))) {
// TODO: dodělat
m_hiddenIndices.removeAll(QPair<int,QModelIndex>(source_row, source_parent));
const_cast<FeedsProxyModel*>(this)->m_hiddenIndices.removeAll(QPair<int,QModelIndex>(source_row, source_parent));
// Load status.
emit expandAfterFilterIn(m_sourceModel->index(source_row, 0, source_parent));
}
if (!should_show) {
const_cast<FeedsProxyModel*>(this)->m_hiddenIndices.append(QPair<int,QModelIndex>(source_row, source_parent));
}
return should_show;
}

View File

@ -57,7 +57,7 @@ class FeedsProxyModel : public QSortFilterProxyModel {
void invalidateFilter();
signals:
void expandAfterFilterIn(const QModelIndex &idx);
void expandAfterFilterIn(QModelIndex idx) const;
private:
// Compares two rows of data.

View File

@ -61,7 +61,10 @@ FeedsView::FeedsView(QWidget *parent)
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder)));
connect(m_proxyModel, &FeedsProxyModel::expandAfterFilterIn, [=](const QModelIndex &idx) {
QTimer::singleShot(100, this, [=] {
// TODO: Z nastavení.
setExpanded(m_proxyModel->mapFromSource(idx), true);
});
});
setModel(m_proxyModel);