4 #include <QGraphicsView>
5 #include <QItemSelectionModel>
7 #include <QtPropertyAnimation> //! Not yet officially in Qt!
10 #include "ornamentedobj.h"
15 /*! \brief Main widget in vym to display and edit a map */
18 class MapEditor : public QGraphicsView {
20 Q_PROPERTY(qreal zoomFactor READ getZoomFactor WRITE setZoomFactor)
21 Q_PROPERTY(QPointF scrollBarPos READ getScrollBarPos WRITE setScrollBarPos)
24 MapEditor(VymModel *vm);
27 QGraphicsScene * getScene();
31 QPointF scrollBarPosTarget;
32 QtPropertyAnimation scrollBarPosAnimation;
34 void setScrollBarPosTarget (const QRectF &rect); //! ensureVisible of rect
35 QPointF getScrollBarPosTarget ();
36 void setScrollBarPos (const QPointF &p);
37 QPointF getScrollBarPos();
41 qreal zoomFactorTarget;
42 QtPropertyAnimation zoomAnimation;
44 void setZoomFactorTarget (const qreal &zf);
45 qreal getZoomFactorTarget();
46 void setZoomFactor (const qreal &zf);
47 qreal getZoomFactor();
50 void print(); //!< Print the map
51 void setAntiAlias (bool); //!< Set or unset antialiasing
52 void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
54 TreeItem *findMapItem (QPointF p,TreeItem *exclude); //! find item in map at position p. Ignore item exclude
56 AttributeTable* attributeTable();
57 void testFunction1(); // just testing new stuff
58 void testFunction2(); // just testing new stuff
62 void editHeadingFinished();
68 virtual void contextMenuEvent ( QContextMenuEvent *e );
69 virtual void keyPressEvent(QKeyEvent*);
70 virtual void keyReleaseEvent(QKeyEvent*);
71 virtual void mousePressEvent(QMouseEvent*);
72 virtual void mouseMoveEvent(QMouseEvent*);
73 virtual void mouseReleaseEvent(QMouseEvent*);
74 virtual void mouseDoubleClickEvent(QMouseEvent*);
75 virtual void resizeEvent( QResizeEvent * );
77 void dragEnterEvent (QDragEnterEvent *);
78 void dragMoveEvent (QDragMoveEvent *);
79 void dragLeaveEvent (QDragLeaveEvent *);
80 void dropEvent (QDropEvent *);
84 QGraphicsScene *mapScene;
85 VymModel *model; //!< Vym Map, includding several mapCenters
87 bool adjustCanvasRequested; // collect requests until end of user event
88 BranchObj *editingBO; // entering Text into BO
90 QCursor HandOpenCursor; // cursor while moving canvas view
91 QCursor PickColorCursor; // cursor while picking color
92 QCursor CopyCursor; // cursor while picking color
93 QCursor XLinkCursor; // cursor while picking color
95 bool drawingLink; // true while creating a link
96 bool copyingObj; // true while creating a link
99 MapObj* movingObj; // moving a MapObj
100 MapObj* linkingObj_src; // part of a link
101 QPointF movingObj_orgPos; // org. pos of mouse before move
102 QPointF movingObj_orgRelPos; // org. relative pos of mouse before move
103 QPointF movingObj_start; // rel. pos of mouse to absPos
104 QPointF movingCont_start; // inital pos of moving Content or
105 QPointF movingVec; // how far has Content moved
107 QPointF contextMenuPos; // position where context event was triggered
109 QPrinter* printer; // Printing
111 AttributeTable *attrTable;
113 bool printFrame; // Print frame around map
114 bool printFooter; // Print footer below map
116 QPoint exportOffset; // set before export, used in save
118 //////////// Selection related
120 void selectionChanged(const QItemSelection &, const QItemSelection &);
123 QList <QGraphicsRectItem*> selboxList;
124 QColor selectionColor;
127 void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
128 void updateData (const QModelIndex&); // update data
130 void setSelectionColor (QColor c);
131 QColor getSelectionColor ();