WOrk on correct expand after filtered in.
This commit is contained in:
parent
eb3f2e0174
commit
011f0979c3
3 changed files with 9 additions and 3 deletions
|
@ -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))) {
|
if (should_show && m_hiddenIndices.contains(QPair<int,QModelIndex>(source_row, source_parent))) {
|
||||||
// TODO: dodělat
|
// 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.
|
// Load status.
|
||||||
emit expandAfterFilterIn(m_sourceModel->index(source_row, 0, source_parent));
|
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;
|
return should_show;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class FeedsProxyModel : public QSortFilterProxyModel {
|
||||||
void invalidateFilter();
|
void invalidateFilter();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void expandAfterFilterIn(const QModelIndex &idx);
|
void expandAfterFilterIn(QModelIndex idx) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Compares two rows of data.
|
// Compares two rows of data.
|
||||||
|
|
|
@ -61,7 +61,10 @@ FeedsView::FeedsView(QWidget *parent)
|
||||||
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder)));
|
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder)));
|
||||||
|
|
||||||
connect(m_proxyModel, &FeedsProxyModel::expandAfterFilterIn, [=](const QModelIndex &idx) {
|
connect(m_proxyModel, &FeedsProxyModel::expandAfterFilterIn, [=](const QModelIndex &idx) {
|
||||||
|
QTimer::singleShot(100, this, [=] {
|
||||||
|
// TODO: Z nastavení.
|
||||||
|
setExpanded(m_proxyModel->mapFromSource(idx), true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
setModel(m_proxyModel);
|
setModel(m_proxyModel);
|
||||||
|
|
Loading…
Add table
Reference in a new issue