50 lines
1008 B
C++
50 lines
1008 B
C++
#ifndef GRAPHICSVIEWMOD_H
|
|
#define GRAPHICSVIEWMOD_H
|
|
|
|
#include <QGraphicsView>
|
|
#include <QPainter>
|
|
#include <QWheelEvent>
|
|
#include <QGraphicsRectItem>
|
|
#include "math.h"
|
|
#include "groundobj.h"
|
|
#include "airobj.h"
|
|
|
|
class GraphicsViewMod : public QGraphicsView
|
|
{
|
|
|
|
public:
|
|
GraphicsViewMod(QWidget *parent);
|
|
|
|
|
|
QPointF reper;
|
|
|
|
int uid, dScale;
|
|
|
|
bool drawSpecialLine;
|
|
QPointF cursPos;
|
|
|
|
|
|
bool isDrawCoords() {return drawCoords;}
|
|
void setDrawCoords(bool f=true) { drawCoords=f;}
|
|
|
|
qreal defSize;
|
|
QList<groundObj*> *obj;
|
|
QList<airObj*> *tar;
|
|
|
|
|
|
void setLinks(QList<groundObj*> *g, QList<airObj*>*t) {obj=g;tar=t;}
|
|
protected:
|
|
void drawForeground(QPainter *painter, const QRectF &rect);
|
|
void drawBackground(QPainter *painter, const QRectF &rect);
|
|
bool drawCoords;
|
|
|
|
private:
|
|
virtual void mouseReleaseEvent(QMouseEvent *event);
|
|
virtual void mouseMoveEvent(QMouseEvent *event);
|
|
virtual void wheelEvent(QWheelEvent *event);
|
|
|
|
|
|
};
|
|
|
|
#endif // GRAPHICSVIEWMOD_H
|