sheetview.h
1 /*
2  name: tools/editor/sheetview.h
3 
4  This file is part of ARCS - Augmented Reality Component System
5  (version 2-current), written by Jean-Yves Didier
6  for IBISC Laboratory (http://www.ibisc.univ-evry.fr)
7 
8  Copyright (C) 2013 Université d'Evry-Val d'Essonne
9 
10  This program is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
23 
24  Please send bugreports with examples or suggestions to
25  jean-yves.didier__at__ibisc.univ-evry.fr
26 */
27 
28 
29 #ifndef __SHEETVIEW_H__
30 #define __SHEETVIEW_H__
31 
32 //#include <QWidget>
33 #include <QGraphicsView>
34 #include <QAction>
35 #include <arcs/arcssheet.h>
36 #include "graphicsinvocationitem.h"
37 
38 class QAction;
39 class QToolBar ;
41 class QGraphicsRectItem;
42 
43 class SheetView : public QGraphicsView
44 {
45 Q_OBJECT
46 
47 public:
48  explicit SheetView(ARCSSheet& s, QWidget* parent=0);
49  virtual ~SheetView();
50 
51  void addComponent(QPoint p, QString name);
52  ARCSSheet& getSheet() { return sheet; }
53 
54  void sendWidget(QWidget* w) {
55  w->setProperty("appId",property("appId"));
56  emit addWidget(w);
57  }
58 
59 protected:
60  virtual void dragEnterEvent(QDragEnterEvent *event) ;
61  virtual void dragMoveEvent(QDragMoveEvent *event) ;
62  virtual void dropEvent(QDropEvent *event);
63 
64  virtual void mousePressEvent(QMouseEvent *event);
65  virtual void mouseReleaseEvent(QMouseEvent *event);
66  virtual void mouseMoveEvent(QMouseEvent *event);
67 
68  virtual void contextMenuEvent(QContextMenuEvent *event);
69 
70 
71 public slots:
72  void updateSheet();
73  void copy();
74  void paste();
75  void deleteSelection();
76  void clearSelection();
77  void selectAll();
78  void orderInvocations();
79  void orderConnections();
80 
81 signals:
82  void addWidget(QWidget*);
83  void requestApplicationUpdate();
84 
85 private:
86  void clearScene();
87 
88  GraphicsComponentItem* findComponentByName(QString name);
89  void layoutSheet();
90  void layoutInvocations(GraphicsInvocationItem::InvocationType invocationType,QStringList destinations,QStringList slotList,QStringList typeList, QStringList valueList );
91 
92 
93  //QToolBar* toolBar;
94  ARCSSheet& sheet;
95  QStringList componentList;
96  QGraphicsRectItem* rectSelection;
97 
98  QAction* actionSelectAll;
99  QAction* actionCopy;
100  QAction* actionPaste;
101  QAction* actionDelete;
102 
103  QAction* actionOrderInvocations;
104  QAction* actionOrderConnections;
105 
106 };
107 
108 
109 #endif // __SHEETVIEW_H__
void addComponent(QPoint p, QString name)
Definition: sheetview.cpp:384
void setProperty(QString name, QString value)
Definition: arcssheet.h:214
void copy()
Definition: sheetview.cpp:634
Maintains connections between objects.
Definition: arcssheet.h:48