WOrk on correct expand after filtered in.
This commit is contained in:
parent
eb3f2e0174
commit
011f0979c3
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user