All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AnimationView.cpp
Go to the documentation of this file.
1 #include "AnimationView.h"
2 #include "../canvas/MapDisplay.h"
3 
4 //QT
5 #include <QtCore/QEvent>
6 #include <QtCore/QCoreApplication>
7 #include <QtGui/QMouseEvent>
8 //#include <QtWidgets/QGridLayout>
9 
11  : QGraphicsView(parent),
12  m_display(parent),
13  m_dragDropAccepted(false)
14 {
15  setMouseTracking(true);
16  setAcceptDrops(true);
17  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
18  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
19  setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
20  setResizeAnchor(QGraphicsView::NoAnchor);
21  //installEventFilter(this);
22 }
23 
25 {
26 }
27 
29 {
30  QCoreApplication::sendEvent(m_display, (QEvent*)e);
31 }
32 
34 {
35  QCoreApplication::sendEvent(m_display, (QEvent*)e);
36 }
37 
39 {
40  QCoreApplication::sendEvent(m_display, (QEvent*)e);
41 }
42 
44 {
45  QCoreApplication::sendEvent(m_display, (QEvent*)e);
46 }
47 
49 {
50  QCoreApplication::sendEvent(m_display, (QEvent*)e);
51 }
52 
54 {
55  QCoreApplication::sendEvent(m_display, (QEvent*)e);
56 }
57 
59 {
60  QCoreApplication::sendEvent(m_display, (QEvent*)e);
61 }
62 
64 {
65  QCoreApplication::sendEvent(m_display, (QEvent*)e);
66 }
67 
69 {
70  QGraphicsScene* scene = this->scene();
71  if(scene)
72  {
73  //te::gm::Envelope box = m_display->getExtent();
74  //QRectF r(box.getLowerLeftX()-box.getWidth(), box.getLowerLeftY()-box.getHeight(), 4*box.getWidth(), 4*box.getHeight());
75  //ensureVisible(r, 0, 0);
76 
77  QRectF r = scene->sceneRect();
78  fitInView(r);
79  //ensureVisible(r, 0, 0);
80 
81  //double xScale = static_cast<double>(width()) / (r.width());
82  //double yScale = static_cast<double>(height()) / (r.height());
83 
84  //QMatrix matrix;
85  //matrix.scale(xScale, -yScale);
86  //matrix.translate(-r.left(), -r.top());
87 
88  //setMatrix(matrix);
89  }
90 }
91 
93 {
94  emit animationDragEnterEvent(e);
95 }
96 
98 {
99  m_dragDropAccepted = false;
100  e->setAccepted(m_dragDropAccepted);
101 }
102 
104 {
105  e->setAccepted(m_dragDropAccepted);
106 }
107 
109 {
110  if(m_dragDropAccepted)
111  emit animationDropEvent(e);
112 }
113 
114 
115 //bool te::qt::widgets::AnimationView::eventFilter(QObject* obj, QEvent* e)
116 //{
117 // if(obj == this)
118 // {
119 // QCoreApplication::sendEvent(m_display, e);
120 // return true;
121 // }
122 // return QObject::eventFilter(obj, e);;
123 //}
void mousePressEvent(QMouseEvent *)
void dragLeaveEvent(QDragLeaveEvent *)
void dragEnterEvent(QDragEnterEvent *)
AnimationView(te::qt::widgets::MapDisplay *md)
Constructor It constructs a AnimationView.
void dragMoveEvent(QDragMoveEvent *)
void keyReleaseEvent(QKeyEvent *)
A widget to control the display of a set of layers.
Definition: MapDisplay.h:66
void resizeEvent(QResizeEvent *)
void mouseReleaseEvent(QMouseEvent *)
void mouseMoveEvent(QMouseEvent *)
void mouseDoubleClickEvent(QMouseEvent *)
virtual ~AnimationView()
Destructor It destructs a Animation.