1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#ifndef FIGURE2D_H
#define FIGURE2D_H
#include <QWidget>
#include <QGraphicsView>
#include <QHash>
#include <vibesscene2d.h>
class QComboBox;
class QLabel;
class Figure2D : public QGraphicsView
{
Q_OBJECT
QHash<QString, QGraphicsItemGroup*> named_groups;
QHash<QString, QGraphicsItem*> named_items;
QComboBox *cbProjX, *cbProjY;
QLabel *lbProjX, *lbProjY;
public:
explicit Figure2D(QWidget *parent = 0);
VibesScene2D* scene() const {return static_cast<VibesScene2D*>( QGraphicsView::scene() );}
protected:
bool eventFilter(QObject *obj, QEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void drawForeground(QPainter *painter, const QRectF &rect);
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *event);
// bool to indicate if axis needs to be drawn or not
bool showAxis;
int fontSize;
int xTicksSpacing;
int yTicksSpacing;
signals:
public slots:
void exportGraphics(QString fileName = QString());
void setShowAxis(bool value) { showAxis = value;}
protected slots:
void refreshProjectionSelectors();
};
#endif // FIGURE2D_H
|