Back to index

salome-gui  6.5.0
TreeView.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // Author: Guillaume Boulant (EDF/R&D)
00021 
00022 
00023 #ifndef TREEVIEW_H
00024 #define TREEVIEW_H
00025 
00026 #include "TreeData.hxx"
00027 
00028 #include <QTreeView>
00029 #include <QAction>
00030 #include <QContextMenuEvent>
00031 #include <QList>
00032 
00033 class TREEDATA_EXPORT TreeView : public QTreeView
00034 {
00035   Q_OBJECT
00036 
00037 public:
00038   TreeView(QWidget * parent = 0 );
00039   ~TreeView();
00040   int  addAction(QString label);
00041   void clearActions();
00042   
00043 protected:
00044   void contextMenuEvent(QContextMenuEvent *event);
00045 
00046 private:
00047   int _lastActionId;
00048   QList<QAction*> _listActions;
00049   QString _idToName(int actionId);
00050   int _nameToId(QString actionName);
00051   
00052   // ---
00053 
00054 private slots:
00055   void processMenuAction(QAction * actionSelected);
00056   
00057 signals:
00058   void itemListToProcess(QStringList itemNameIdList, int actionId);
00059 };
00060 
00061 #endif // TREEVIEW_H
00062