Fixed problem with images included in branches. Added missing adaptormodel.* files
4 #include <QGraphicsView>
5 #include <QItemSelectionModel>
7 #include <QtPropertyAnimation> //! Not yet officially in Qt!
10 #include "ornamentedobj.h"
16 /*! \brief Main widget in vym to display and edit a map */
19 class MapEditor : public QGraphicsView {
21 Q_PROPERTY(qreal zoomFactor READ getZoomFactor WRITE setZoomFactor)
22 Q_PROPERTY(QPointF scrollBarPos READ getScrollBarPos WRITE setScrollBarPos)
25 MapEditor(VymModel *vm);
28 QGraphicsScene * getScene();
32 QPointF scrollBarPosTarget;
33 QtPropertyAnimation scrollBarPosAnimation;
35 void scrollTo (const QModelIndex &index);
36 void setScrollBarPosTarget (const QRectF &rect); //! ensureVisible of rect
37 QPointF getScrollBarPosTarget ();
38 void setScrollBarPos (const QPointF &p);
39 QPointF getScrollBarPos();
43 qreal zoomFactorTarget;
44 QtPropertyAnimation zoomAnimation;
46 void setZoomFactorTarget (const qreal &zf);
47 qreal getZoomFactorTarget();
48 void setZoomFactor (const qreal &zf);
49 qreal getZoomFactor();
52 void print(); //!< Print the map
53 QRectF getTotalBBox(); //!< Bounding box of all items in map
54 QPixmap getPixmap(); //!< Get a pixmap of the map
55 void setAntiAlias (bool); //!< Set or unset antialiasing
56 void setSmoothPixmap(bool); //!< Set or unset smoothing of pixmaps
58 TreeItem *findMapItem (QPointF p,TreeItem *exclude); //! find item in map at position p. Ignore item exclude
60 AttributeTable* attributeTable(); // FIXME-3
61 void testFunction1(); // just testing new stuff
62 void testFunction2(); // just testing new stuff
72 void editHeadingFinished();
78 virtual void contextMenuEvent ( QContextMenuEvent *e );
79 virtual void keyPressEvent(QKeyEvent*);
80 virtual void keyReleaseEvent(QKeyEvent*);
81 virtual void mousePressEvent(QMouseEvent*);
82 virtual void mouseMoveEvent(QMouseEvent*);
83 virtual void mouseReleaseEvent(QMouseEvent*);
84 virtual void mouseDoubleClickEvent(QMouseEvent*);
85 virtual void resizeEvent( QResizeEvent * );
87 void dragEnterEvent (QDragEnterEvent *);
88 void dragMoveEvent (QDragMoveEvent *);
89 void dragLeaveEvent (QDragLeaveEvent *);
90 void dropEvent (QDropEvent *);
94 QGraphicsScene *mapScene;
95 VymModel *model; //!< Vym Map, includding several mapCenters
97 bool adjustCanvasRequested; // collect requests until end of user event
98 BranchObj *editingBO; // entering Text into BO
100 QCursor HandOpenCursor; // cursor while moving canvas view
101 QCursor PickColorCursor; // cursor while picking color
102 QCursor CopyCursor; // cursor while picking color
103 QCursor XLinkCursor; // cursor while picking color
105 bool drawingLink; // true while creating a link
106 bool copyingObj; // true while creating a link
109 MapObj* movingObj; // moving a MapObj
110 MapObj* linkingObj_src; // part of a link
111 QPointF movingObj_orgPos; // org. pos of mouse before move
112 QPointF movingObj_orgRelPos; // org. relative pos of mouse before move
113 QPointF movingObj_start; // rel. pos of mouse to absPos
114 QPointF movingCont_start; // inital pos of moving Content or
115 QPointF movingVec; // how far has Content moved
117 QPointF contextMenuPos; // position where context event was triggered
119 QPrinter* printer; // Printing
121 AttributeTable *attrTable;
123 bool printFrame; // Print frame around map
124 bool printFooter; // Print footer below map
126 QPoint exportOffset; // set before export, used in save
128 //////////// Selection related
130 void selectionChanged(const QItemSelection &, const QItemSelection &);
133 QList <QGraphicsRectItem*> selboxList;
134 QColor selectionColor;
137 void updateSelection(QItemSelection ,QItemSelection); // update selection
138 void updateData (const QModelIndex&); // update data
140 void setSelectionColor (QColor c);
141 QColor getSelectionColor ();