krita/ui

kis_composite_ops_model.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 2009 Cyrille Berger <cberger@cberger.net>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef _KIS_COMPOSITE_OPS_MODEL_H_
00020 #define _KIS_COMPOSITE_OPS_MODEL_H_
00021 
00022 #include <QAbstractListModel>
00023 
00024 class KoCompositeOp;
00025 
00029 class KisCompositeOpsModel : public QAbstractListModel
00030 {
00031 public:
00032     enum AdditionalRoles {
00033         CompositeOpSortRole = 0x1FDFDA
00034     };
00035 public:
00036     KisCompositeOpsModel(const QList<KoCompositeOp*>& list);
00037     ~KisCompositeOpsModel();
00038     int rowCount(const QModelIndex & parent = QModelIndex()) const;
00039     QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
00040     const QString& itemAt(const QModelIndex & index) const;
00041     QModelIndex indexOf(const KoCompositeOp*) const;
00045     QModelIndex indexOf(const QString&) const;
00046 private:
00047     struct CompositeOpInfo {
00048         CompositeOpInfo(QString _id, QString _description, QString _category) : id(_id), description(_description), category(_category) {}
00049         QString id;
00050         QString description;
00051         QString category;
00052     };
00053     QList< CompositeOpInfo > m_list;
00054 };
00055 
00056 #endif