-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewscene.cpp
More file actions
43 lines (34 loc) · 922 Bytes
/
newscene.cpp
File metadata and controls
43 lines (34 loc) · 922 Bytes
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
#include "newscene.h"
NewScene::NewScene(QWidget *parent) : QGraphicsScene(parent)
{
}
void NewScene::resize()
{
update();
}
void NewScene::drawBackground(QPainter *painter, const QRectF &rect)
{
QGraphicsScene::drawBackground(painter,rect);
}
void NewScene::drawItems(QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[], QWidget *widget)
{
QGraphicsScene::drawItems(painter,numItems,items,options,widget);
}
void NewScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
pos =event->scenePos();
emit mousePos(pos);
QGraphicsScene::mouseMoveEvent(event);
}
void NewScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if(event->button()==Qt::LeftButton){
emit mousePress();
}
}
void NewScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if(event->button()==Qt::LeftButton){
emit mouseRelease();
}
}