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
68 void editHeadingFinished();
74 virtual void contextMenuEvent ( QContextMenuEvent *e );
75 virtual void keyPressEvent(QKeyEvent*);
76 virtual void keyReleaseEvent(QKeyEvent*);
77 virtual void mousePressEvent(QMouseEvent*);
78 virtual void mouseMoveEvent(QMouseEvent*);
79 virtual void mouseReleaseEvent(QMouseEvent*);
80 virtual void mouseDoubleClickEvent(QMouseEvent*);
81 virtual void resizeEvent( QResizeEvent * );
83 void dragEnterEvent (QDragEnterEvent *);
84 void dragMoveEvent (QDragMoveEvent *);
85 void dragLeaveEvent (QDragLeaveEvent *);
86 void dropEvent (QDropEvent *);
90 QGraphicsScene *mapScene;
91 VymModel *model; //!< Vym Map, includding several mapCenters
93 bool adjustCanvasRequested; // collect requests until end of user event
94 BranchObj *editingBO; // entering Text into BO
96 QCursor HandOpenCursor; // cursor while moving canvas view
97 QCursor PickColorCursor; // cursor while picking color
98 QCursor CopyCursor; // cursor while picking color
99 QCursor XLinkCursor; // cursor while picking color
101 bool drawingLink; // true while creating a link
102 bool copyingObj; // true while creating a link
105 MapObj* movingObj; // moving a MapObj
106 MapObj* linkingObj_src; // part of a link
107 QPointF movingObj_orgPos; // org. pos of mouse before move
108 QPointF movingObj_orgRelPos; // org. relative pos of mouse before move
109 QPointF movingObj_start; // rel. pos of mouse to absPos
110 QPointF movingCont_start; // inital pos of moving Content or
111 QPointF movingVec; // how far has Content moved
113 QPointF contextMenuPos; // position where context event was triggered
115 QPrinter* printer; // Printing
117 AttributeTable *attrTable;
119 bool printFrame; // Print frame around map
120 bool printFooter; // Print footer below map
122 QPoint exportOffset; // set before export, used in save
124 //////////// Selection related
126 void selectionChanged(const QItemSelection &, const QItemSelection &);
129 QList <QGraphicsRectItem*> selboxList;
130 QColor selectionColor;
133 void updateSelection(const QItemSelection &,const QItemSelection &); // update selection
134 void updateData (const QModelIndex&); // update data
136 void setSelectionColor (QColor c);
137 QColor getSelectionColor ();