42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#ifndef DESIGNER_SCENE_H
|
|
#define DESIGNER_SCENE_H
|
|
|
|
#include <QGraphicsScene>
|
|
|
|
class GraphicsItemGroup;
|
|
|
|
class DesignerScene : public QGraphicsScene
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DesignerScene(QObject *parent = 0);
|
|
virtual ~DesignerScene();
|
|
|
|
void setGridVisible(bool);
|
|
void setView(QGraphicsView* view) { m_pView = view; }
|
|
QGraphicsView* getView() { return m_pView; }
|
|
void callParentEvent(QGraphicsSceneMouseEvent*);
|
|
|
|
GraphicsItemGroup* createGroup();
|
|
void destroyGroup();
|
|
|
|
signals:
|
|
void signalAddItem(QGraphicsItem*);
|
|
|
|
protected:
|
|
void drawBackground(QPainter*, const QRectF&) override;
|
|
void mousePressEvent(QGraphicsSceneMouseEvent*) override;
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent*) override;
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent*) override;
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) override;
|
|
void keyPressEvent(QKeyEvent*) override;
|
|
void keyReleaseEvent(QKeyEvent*) override;
|
|
|
|
private:
|
|
bool m_bGridVisible;
|
|
QGraphicsView* m_pView;
|
|
};
|
|
|
|
#endif
|