Home · All Classes · All Namespaces · Modules · Functions · Files

flat-model-proxy.h

00001 /*
00002  * This file is part of TelepathyQt4Yell Models
00003  *
00004  * Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #ifndef _TelepathyQt4Yell_Models_flat_model_proxy_h_HEADER_GUARD_
00022 #define _TelepathyQt4Yell_Models_flat_model_proxy_h_HEADER_GUARD_
00023 
00024 #ifndef IN_TELEPATHY_QT4_YELL_MODELS_HEADER
00025 #error IN_TELEPATHY_QT4_YELL_MODELS_HEADER
00026 #endif
00027 
00028 #include <TelepathyQt4Yell/Models/Global>
00029 
00030 #include <QAbstractProxyModel>
00031 
00032 namespace Tpy
00033 {
00034 
00035 class TELEPATHY_QT4_YELL_MODELS_EXPORT FlatModelProxy : public QAbstractProxyModel
00036 {
00037     Q_OBJECT
00038     Q_DISABLE_COPY(FlatModelProxy)
00039     Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged)
00040 
00041 public:
00042     FlatModelProxy(QAbstractItemModel *source);
00043     virtual ~FlatModelProxy();
00044 
00045     virtual QModelIndex mapFromSource(const QModelIndex &index) const;
00046     virtual QModelIndex mapToSource(const QModelIndex &index) const;
00047     virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
00048     virtual QModelIndex parent(const QModelIndex &index) const;
00049     virtual int rowCount(const QModelIndex &parent) const;
00050     virtual int columnCount(const QModelIndex &parent) const;
00051 
00052     int rowCount() const;
00053 
00054 Q_SIGNALS:
00055     void rowCountChanged();
00056 
00057 private Q_SLOTS:
00058     void onRowsAboutToBeInserted(const QModelIndex &index, int first, int last);
00059     void onRowsInserted(const QModelIndex &index, int first, int last);
00060     void onRowsAboutToBeRemoved(const QModelIndex &index, int first, int last);
00061     void onRowsRemoved(const QModelIndex &index, int first, int last);
00062     void onDataChanged(const QModelIndex &first, const QModelIndex &last);
00063 
00064 private:
00065     struct Private;
00066     friend struct Private;
00067     Private *mPriv;
00068 };
00069 
00070 }
00071 
00072 #endif // _TelepathyQt4Yell_Models_flat_model_proxy_h_HEADER_GUARD_


Copyright © 2008-2010 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4-Yell 0.1.6