Classified ads
profilesearchmodel.h
Go to the documentation of this file.
1 /* -*-C++-*- -*-coding: utf-8-unix;-*-
2  Classified Ads is Copyright (c) Antti Järvinen 2013.
3 
4  This file is part of Classified Ads.
5 
6  Classified Ads is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Classified Ads is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Classified Ads. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef PROFILESEARCHMODEL_H
21 #define PROFILESEARCHMODEL_H
22 
23 #include <QAbstractListModel>
24 #include "../util/hash.h"
25 #include "../mcontroller.h"
26 
27 class Model ;
33 class ProfileSearchModel: public QAbstractListModel {
34  Q_OBJECT
35 public:
36  ProfileSearchModel(Model& aModel) ;
38 
39  void setSearchString(const QString& aSearch) ;
44  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const ;
49  virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const ;
50 signals:
52  const QString& aExplanation) ;
53 private:// methods
54  void performSearch() ;
55 private: // data
57  QList<QPair<Hash,QString> > iProfiles ;
58  QString iSearchString ;
59 } ;
60 #endif
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
void setSearchString(const QString &aSearch)
ProfileSearchModel(Model &aModel)
Model & iModel
Definition: profilesearchmodel.h:56
CAErrorSituation
Definition: mcontroller.h:48
void error(MController::CAErrorSituation aError, const QString &aExplanation)
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QString iSearchString
Definition: profilesearchmodel.h:58
M of the MVC pattern. Handles permanent storage.
Definition: model.h:47
Model-class for performing a name-based search of profiles. This is supposed to act as an underlying ...
Definition: profilesearchmodel.h:33
QList< QPair< Hash, QString > > iProfiles
Definition: profilesearchmodel.h:57