Quantum GIS API Documentation  1.8
src/core/qgsdbfilterproxymodel.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgsdbfilterproxymodel.cpp  -  description
00003                          -------------------------
00004     begin                : Dec 2007
00005     copyright            : (C) 2007 by Marco Hugentobler
00006     email                : marco dot hugentobler at karto dot baug dot ethz dot ch
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "qgsdbfilterproxymodel.h"
00019 
00020 QgsDbFilterProxyModel::QgsDbFilterProxyModel( QObject* parent ): QSortFilterProxyModel( parent )
00021 {
00022 
00023 }
00024 
00025 QgsDbFilterProxyModel::~QgsDbFilterProxyModel()
00026 {
00027 
00028 }
00029 
00030 bool QgsDbFilterProxyModel::filterAcceptsRow( int row, const QModelIndex & source_parent ) const
00031 {
00032   //if parent is valid, we have a toplevel item that should be always shown
00033   if ( !source_parent.isValid() )
00034   {
00035     return true;
00036   }
00037 
00038   //else we have a row that describes a table and that
00039   //should be tested using the given wildcard/regexp
00040   return QSortFilterProxyModel::filterAcceptsRow( row, source_parent );
00041 }
00042 
00043 void QgsDbFilterProxyModel::_setFilterWildcard( const QString& pattern )
00044 {
00045   QSortFilterProxyModel::setFilterWildcard( pattern );
00046   emit layoutChanged();
00047 }
00048 
00049 void QgsDbFilterProxyModel::_setFilterRegExp( const QString& pattern )
00050 {
00051   QSortFilterProxyModel::setFilterRegExp( pattern );
00052   emit layoutChanged();
00053 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines