1 /**********************************************************************
2 PrimitiveItemModel - Model for representing primitives.
4 Copyright (C) 2007 Donald Ephraim Curtis <dcurtis3@sourceforge.net>
6 This file is part of the Avogadro molecular editor project.
7 For more information, see <http://avogadro.sourceforge.net/>
9 Avogadro is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 Avogadro is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 **********************************************************************/
25 #ifndef __PRIMITIVEITEMMODEL_H
26 #define __PRIMITIVEITEMMODEL_H
28 #include <avogadro/global.h>
29 #include <avogadro/engine.h>
35 class PrimitiveItemModelPrivate
;
36 class A_EXPORT PrimitiveItemModel
: public QAbstractItemModel
42 PrimitiveRole
= Qt::UserRole
+ 1,
47 explicit PrimitiveItemModel( Engine
*engine
, QObject
*parent
= 0 );
48 explicit PrimitiveItemModel( Molecule
*molecule
, QObject
*parent
= 0 );
50 QModelIndex
parent( const QModelIndex
& index
) const;
51 int rowCount( const QModelIndex
& parent
= QModelIndex() ) const;
52 int columnCount( const QModelIndex
& parent
= QModelIndex() ) const;
53 QVariant
data ( const QModelIndex
& index
, int role
= Qt::DisplayRole
) const;
54 Qt::ItemFlags
flags ( const QModelIndex
& index
) const;
56 QModelIndex
index ( int row
, int column
, const QModelIndex
& parent
= QModelIndex() ) const;
60 void addPrimitive(Primitive
*primitive
);
61 void updatePrimitive(Primitive
*primitive
);
62 void removePrimitive(Primitive
*primitive
);
65 PrimitiveItemModelPrivate
* const d
;
67 int primitiveIndex(Primitive
*primitive
);
71 } // end namespace Avogadro
73 #endif // __PRIMITIVEITEMMODEL_H