1 #include "shareboardcanvas.h"
8 ShareboardCanvas::ShareboardCanvas(QWidget* parent) : QWidget(parent) {
9 setMinimumSize(640,480);
10 setMouseTracking(true);
11 currentScene = new QPixmap(size());
16 ShareboardCanvas::~ShareboardCanvas() {
21 void ShareboardCanvas::mouseMoveEvent(QMouseEvent* event) {
22 // Send mouse move event to network thread
23 // If the button is down
25 dragPath.append(event->posF());
30 void ShareboardCanvas::mousePressEvent(QMouseEvent* event) {
32 dragPath.append(event->posF()); // We're starting a new drag path
36 void ShareboardCanvas::mouseReleaseEvent(QMouseEvent* event) {
38 qDebug() << dragPath.size() << "mouse move events counted this drag";
39 // Depending on the tool, we now dispatch different types of events
40 dragPath.clear(); // Clear the path; we're no longer tracking a drag
43 void ShareboardCanvas::paintEvent(QPaintEvent* event) {
45 // Paint the background from the saved state
46 p.drawPixmap(0, 0, *currentScene);
47 // Now paint our local changes on top of it
49 // Now paint the set of mouse cursors on top of that