GeopsyGui/SignalGroupItem.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyGui.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2006-08-29
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef SIGNALGROUPITEM_H
00029 #define SIGNALGROUPITEM_H
00030 
00031 #include <GeopsyCore.h>
00032 #include <QtGui>
00033 
00034 #include "GeopsyGuiDLLExport.h"
00035 
00036 namespace GeopsyGui {
00037 
00038 class GEOPSYGUI_EXPORT SignalGroupItem: public QAbstractItemModel
00039 {
00040   Q_OBJECT
00041 public:
00042   SignalGroupItem(QObject * parent=0);
00043   ~SignalGroupItem() {}
00044 
00045   void setDatabase(SignalDB * db);
00046 
00047   virtual int rowCount(const QModelIndex& parent=QModelIndex()) const;
00048   virtual int columnCount(const QModelIndex& parent=QModelIndex()) const;
00049   virtual QVariant data(const QModelIndex& index, int role) const;
00050   virtual bool setData(const QModelIndex& index, const QVariant& value, int role=Qt::EditRole);
00051   virtual QModelIndex parent(const QModelIndex& index) const;
00052   virtual QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const;
00053   virtual Qt::ItemFlags flags(const QModelIndex&) const;
00054   virtual QStringList mimeTypes() const;
00055   virtual Qt::DropActions supportedDropActions() const;
00056   virtual QMimeData * mimeData(const QModelIndexList& indexes) const;
00057   virtual bool dropMimeData(const QMimeData * data, Qt::DropAction action,
00058                             int row, int column, const QModelIndex& parent);
00059 
00060   void getSelection(SubSignalPool& sel, const QItemSelectionModel& sm, const QModelIndex& parent=QModelIndex());
00061   void getSelection(QList<AbstractSignalGroup *>& sel, const QItemSelectionModel& sm, const QModelIndex& parent=QModelIndex());
00062   static AbstractSignalGroup * group(const QModelIndex& index);
00063   QModelIndex index(AbstractSignalGroup * g) const;
00064 private slots:
00065   void databaseDestroyed();
00066   void dataChanged(AbstractSignalGroup * g);
00067   void parentAboutToBeChanged(AbstractSignalGroup * g, AbstractSignalGroup * newParent);
00068   void parentChanged(AbstractSignalGroup * g, AbstractSignalGroup * oldParent);
00069 protected:
00070   SignalDB * _db;
00071 };
00072 
00073 
00074 } // namespace GeopsyGui
00075 
00076 #endif // SIGNALGROUPITEM_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines