test filtering behavior
This commit is contained in:
parent
70d915fc5c
commit
6cbcef3ee5
@ -495,6 +495,12 @@ void FeedsView::focusInEvent(QFocusEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::filterItems(const QString& pattern) {
|
void FeedsView::filterItems(const QString& pattern) {
|
||||||
|
if (!pattern.isEmpty()) {
|
||||||
|
m_dontSaveExpandState = true;
|
||||||
|
expandAll();
|
||||||
|
m_dontSaveExpandState = false;
|
||||||
|
}
|
||||||
|
|
||||||
#if QT_VERSION < 0x050C00 // Qt < 5.12.0
|
#if QT_VERSION < 0x050C00 // Qt < 5.12.0
|
||||||
m_proxyModel->setFilterRegExp(pattern.toLower());
|
m_proxyModel->setFilterRegExp(pattern.toLower());
|
||||||
#else
|
#else
|
||||||
@ -504,14 +510,6 @@ void FeedsView::filterItems(const QString& pattern) {
|
|||||||
if (pattern.isEmpty()) {
|
if (pattern.isEmpty()) {
|
||||||
loadAllExpandStates();
|
loadAllExpandStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
else {
|
|
||||||
m_isDontSaveExpandState = true;
|
|
||||||
expandAll();
|
|
||||||
m_isDontSaveExpandState = false;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::onIndexExpanded(const QModelIndex& idx) {
|
void FeedsView::onIndexExpanded(const QModelIndex& idx) {
|
||||||
@ -603,17 +601,18 @@ void FeedsView::loadAllExpandStates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FeedsView::expandItemDelayed(const QModelIndex& source_idx) {
|
void FeedsView::expandItemDelayed(const QModelIndex& source_idx) {
|
||||||
QTimer::singleShot(100, this, [=] {
|
//QTimer::singleShot(100, this, [=] {
|
||||||
// Model requests to expand some items as they are visible and there is
|
// Model requests to expand some items as they are visible and there is
|
||||||
// a filter active, so they maybe were not visible before.
|
// a filter active, so they maybe were not visible before.
|
||||||
QModelIndex pidx = m_proxyModel->mapFromSource(source_idx);
|
QModelIndex pidx = m_proxyModel->mapFromSource(source_idx);
|
||||||
|
|
||||||
// NOTE: These changes are caused by filtering mechanisms
|
// NOTE: These changes are caused by filtering mechanisms
|
||||||
// and we don't want to store the values.
|
// and we don't want to store the values.
|
||||||
m_dontSaveExpandState = true;
|
m_dontSaveExpandState = true;
|
||||||
expandRecursively(pidx);
|
expandRecursively(pidx);
|
||||||
m_dontSaveExpandState = false;
|
m_dontSaveExpandState = false;
|
||||||
});
|
|
||||||
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu* FeedsView::initializeContextMenuCategories(RootItem* clicked_item) {
|
QMenu* FeedsView::initializeContextMenuCategories(RootItem* clicked_item) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user