Subversion Repositories Scribus

Rev

Rev 13809 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13809 pierre 1
/***************************************************************************
2
 *   Copyright (C) 2009 by Pierre Marchand                                 *
3
 *   pierre@oep-h.com                                                      *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 *                                                                         *
10
 *   This program is distributed in the hope that it will be useful,       *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18122 mrdocs 18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
13809 pierre 19
 ***************************************************************************/
20
 
21
#ifndef OPENPALETTEMODEL_H
22
#define OPENPALETTEMODEL_H
23
 
24
#include <QAbstractItemModel>
25
 
26
 
27
 
28
/**
29
  * Provides a model to attach to a treeview representing
30
  * the state of open palettes configuration.
31
  * Its own data being actually hold by OpenPaletteManager,
32
  * so most of the implementations of virtual methods are in fact
33
  * forwarded to OpenPaletteManager.
34
  */
35
 
36
class OpenPaletteModel : public QAbstractItemModel
37
{
38
        Q_OBJECT
39
        OpenPaletteModel(){}
40
public:
41
        OpenPaletteModel( QObject * parent );
42
 
43
        /// Standard reimplementations for an abstract item model (read-only)
44
        QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
45
        QModelIndex parent ( const QModelIndex & index ) const;
46
        Qt::ItemFlags flags ( const QModelIndex & index ) const;
47
        QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
48
        QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
49
        int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
50
        int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
51
 
52
        // write
53
        bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
54
 
55
 
56
private:
57
        bool isTopIndex(const QModelIndex & index) const;
58
 
59
public slots:
60
        void paletteChanged();
61
 
62
};
63
 
64
#endif // OPENPALETTEMODEL_H