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
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (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 GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with Classified Ads; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef PROFILESEARCHMODEL_H
22 #define PROFILESEARCHMODEL_H
23 
24 #include <QAbstractListModel>
25 #include "../util/hash.h"
26 #include "../mcontroller.h"
27 
28 class Model ;
34 class ProfileSearchModel: public QAbstractListModel {
35  Q_OBJECT
36 public:
37  ProfileSearchModel(Model& aModel) ;
39 
40  void setSearchString(const QString& aSearch) ;
45  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const ;
50  virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const ;
51 signals:
53  const QString& aExplanation) ;
54 private:// methods
55  void performSearch() ;
56 private: // data
58  QList<QPair<Hash,QString> > iProfiles ;
59  QString iSearchString ;
60 } ;
61 #endif
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
void setSearchString(const QString &aSearch)
ProfileSearchModel(Model &aModel)
Model & iModel
Definition: profilesearchmodel.h:57
CAErrorSituation
Definition: mcontroller.h:57
void error(MController::CAErrorSituation aError, const QString &aExplanation)
QString iSearchString
Definition: profilesearchmodel.h:59
M of the MVC pattern. Handles permanent storage.
Definition: model.h:50
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Model-class for performing a name-based search of profiles. This is supposed to act as an underlying ...
Definition: profilesearchmodel.h:34
QList< QPair< Hash, QString > > iProfiles
Definition: profilesearchmodel.h:58