tweaked filter
This commit is contained in:
parent
aa049585b5
commit
b518f8968a
|
@ -1010,12 +1010,12 @@ void MainWindow::removeEntry()
|
|||
*/
|
||||
void MainWindow::applyFilter(const QString &filterText)
|
||||
{
|
||||
m_entryFilterModel->setFilterRegExp(filterText);
|
||||
if(filterText.isEmpty()) {
|
||||
applyDefaultExpanding(QModelIndex());
|
||||
} else {
|
||||
m_ui->treeView->expandAll();
|
||||
}
|
||||
m_entryFilterModel->setFilterRegExp(filterText);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -19,9 +19,17 @@ EntryFilterModel::EntryFilterModel(QObject *parent) :
|
|||
|
||||
bool EntryFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
// just use default implementation
|
||||
if(QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// also accept rows where the direct parent is accepted
|
||||
if(sourceParent.isValid() && QSortFilterProxyModel::filterAcceptsRow(sourceParent.row(), sourceParent.parent())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// also accept rows which contain accepted childs
|
||||
return hasAcceptedChildren(sourceModel()->index(sourceRow, 0, sourceParent));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "./entrymodel.h"
|
||||
|
||||
#ifdef MODEL_UNDO_SUPPORT
|
||||
#include "./gui/undocommands.h"
|
||||
# include "./gui/undocommands.h"
|
||||
#endif
|
||||
|
||||
#include <passwordfile/io/entry.h>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "./fieldmodel.h"
|
||||
|
||||
#ifdef MODEL_UNDO_SUPPORT
|
||||
#include "./gui/undocommands.h"
|
||||
# include "./gui/undocommands.h"
|
||||
#endif
|
||||
|
||||
#include <passwordfile/io/field.h>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#ifndef FIELDMODEL_H
|
||||
#define FIELDMODEL_H
|
||||
|
||||
#include <passwordfile/io/entry.h>
|
||||
#ifdef MODEL_UNDO_SUPPORT
|
||||
#include "gui/stacksupport.h"
|
||||
# include "gui/stacksupport.h"
|
||||
#endif
|
||||
|
||||
#include <passwordfile/io/entry.h>
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
#include <vector>
|
||||
|
|
Loading…
Reference in New Issue