diff options
author | Arno <am@disconnect.de> | 2013-10-13 07:25:50 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-10-13 07:25:50 +0200 |
commit | e07de4e0a1bd56aab8f4ee81d6db252e442c3d7a (patch) | |
tree | 02b62d34152e481917ba1bef6a7191e4e3465c72 /archivemodel.cpp | |
parent | 5beb56a09363197e23a630d3fd2f71899d7f00a0 (diff) | |
download | SheMov-e07de4e0a1bd56aab8f4ee81d6db252e442c3d7a.tar.gz SheMov-e07de4e0a1bd56aab8f4ee81d6db252e442c3d7a.tar.bz2 SheMov-e07de4e0a1bd56aab8f4ee81d6db252e442c3d7a.zip |
Add filter bar to MappingTreeWidget
Move matchRecursive from ArchiveModel to SmTreeModel so we can use it
here, too.
Diffstat (limited to 'archivemodel.cpp')
-rw-r--r-- | archivemodel.cpp | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/archivemodel.cpp b/archivemodel.cpp index 0f266ca..212c60d 100644 --- a/archivemodel.cpp +++ b/archivemodel.cpp @@ -163,38 +163,6 @@ bool ArchiveModel::setData(const QModelIndex &idx, const QVariant &value, int ro return false; } -bool ArchiveModel::matchRecursive(const QModelIndex &parent, const QRegExp ®ex, int column) const { - if(!parent.isValid()){ - return false; - } - // first try the parent itself - QString value = parent.data().toString(); - if(value.isEmpty()){ - return false; - } - if(value.contains(regex)){ - return true; - } - - // no match, check for children - SmTreeItem *item = static_cast<SmTreeItem*>(parent.internalPointer()); - if(!item->childCount()){ - //leaf, chech parents - return checkParents(item, regex, column); - } - - // we have children, traverse them - bool retval = false; - for(int i = 0; i < item->childCount(); ++i){ - QModelIndex newIdx = createIndex(i, column, item->child(i)); - retval = matchRecursive(newIdx, regex, column); - if(retval){ - break; - } - } - return retval; -} - bool ArchiveModel::removeNode(const QModelIndex &idx){ if(!idx.isValid()){ return false; @@ -619,17 +587,6 @@ void ArchiveModel::collectorFinished(QObject *thread){ emit message(msg); } -bool ArchiveModel::checkParents(const SmTreeItem *item, const QRegExp ®ex, int column) const { - while(item != root()){ - QString value = item->data(column).toString(); - if(value.contains(regex)){ - return true; - } - item = item->parent(); - } - return false; -} - void ArchiveModel::emitDatabaseError(const QSqlError &e){ QString databaseText = e.databaseText().isEmpty() ? tr("(none)") : e.databaseText(); QString driverText = e.driverText().isEmpty() ? tr("(none)") : e.driverText(); |