-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaintGracy.cpp
37 lines (27 loc) · 953 Bytes
/
PaintGracy.cpp
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
//
// Created by kurum on 12/5/2022.
//
#include "PaintGracy.h"
PaintGracy::PaintGracy(QWidget *parents) : QGraphicsView(parents) {
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(parents->sizePolicy().hasHeightForWidth());
// setDragMode(QGraphicsView::NoDrag);
this->setSizePolicy(sizePolicy);
this->setSizeAdjustPolicy(AdjustToContents);
}
void PaintGracy::mousePressEvent(QMouseEvent *event) {
if (event->button() == Qt::LeftButton)
emit mouse_click(LEFT_B, event->pos());
else
emit mouse_click(RIGHT_B, event->pos());
QGraphicsView::mousePressEvent(event);
}
void PaintGracy::mouseMoveEvent(QMouseEvent *event) {
QGraphicsView::mouseMoveEvent(event);
emit mouse_move(event->pos());
//update();
}
void PaintGracy::on_resized(int screen) {
}