• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

rocs/VisualEditor

  • sources
  • kde-4.12
  • kdeedu
  • rocs
  • VisualEditor
  • Scene
GraphScene.h
Go to the documentation of this file.
1 /*
2  This file is part of Rocs,
3  Copyright 2004-2011 Tomaz Canabrava <tomaz.canabrava@gmail.com>
4  Copyright 2013 Andreas Cord-Landwehr <cola@uni-paderborn.de>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef SUI_GRAPHSCENE_H
21 #define SUI_GRAPHSCENE_H
22 
23 #include "VisualEditorExport.h"
24 #include <QGraphicsScene>
25 #include <QMultiHash>
26 #include "CoreTypes.h"
27 
28 class AbstractAction;
29 class Document;
30 class QAction;
31 class QGraphicsItem;
32 class QGraphicsSceneMouseEvent;
33 class QGraphicsSceneWheelEvent;
34 class QGraphicsSceneContextMenuEvent;
35 class QKeyEvent;
36 class QMenu;
37 
38 class VISUALEDITOR_EXPORT GraphScene : public QGraphicsScene
39 {
40  Q_OBJECT
41 public:
42  explicit GraphScene(QObject *parent);
43  void setAction(QAction *action);
44  void updateGraph(DataStructurePtr g);
45  void updateDocument();
46  void setActiveGraph(DataStructurePtr g);
47  void clearGraph();
48  qreal zoomFactor() const;
49  void zoomBy(qreal scaleFactor);
50  void zoomTo(qreal scaleFactor);
51  void zoomToRect(const QRectF &rect);
52  void resetZoom();
53  void centerOn(const QPointF &pos);
54 
55 public slots:
56  QGraphicsItem * createData(DataPtr n);
57  QGraphicsItem * createEdge(PointerPtr e);
58  void connectGraphSignals(DataStructurePtr g);
59 
63  void createItems(DataStructurePtr dataStructure);
64 
68  void createItems();
69  void setActiveDocument();
70  void resize();
71 
72 signals:
73  void resized();
74  void keyPressed(QKeyEvent *key);
75  void keyReleased(QKeyEvent *key);
76  void addData(const QPointF &pos);
77  void removeSelected();
78  void zoomFactorChanged(qreal zoomFactor);
79 
80 protected:
81  void mouseMoveEvent(QGraphicsSceneMouseEvent* mouseEvent);
82  void mousePressEvent(QGraphicsSceneMouseEvent* mouseEvent);
83  void mouseReleaseEvent(QGraphicsSceneMouseEvent* mouseEvent);
84  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* mouseEvent);
85  void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
86  void wheelEvent(QGraphicsSceneWheelEvent* wheelEvent);
87  void keyPressEvent(QKeyEvent *keyEvent);
88  void keyReleaseEvent(QKeyEvent *keyEvent);
89 
90 private:
91  QMenu * createContextMenu(const QPointF &scenePosition, const QPointF &screenPosition);
92  QMenu *_contextMenu;
93  Document *_graphDocument;
94  DataStructurePtr _graph;
95  AbstractAction *_action;
96  QMultiHash<DataStructure*, QGraphicsItem* > _hashGraphs;
97  QGraphicsRectItem *_whiteboard;
98  void releaseDocument();
99  qreal _zoomFactor;
100 };
101 
102 #endif
VISUALEDITOR_EXPORT
#define VISUALEDITOR_EXPORT
Definition: VisualEditorExport.h:31
QGraphicsScene
VisualEditorExport.h
QObject
AbstractAction
the base class for custom actions. This class provides the basic functionality for all custom actions...
Definition: AbstractAction.h:36
GraphScene
Definition: GraphScene.h:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:46 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

rocs/VisualEditor

Skip menu "rocs/VisualEditor"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal