1 #include "shareboardcanvas.h"
7 #include "shareboard.h"
9 ShareboardCanvas::ShareboardCanvas(QWidget* parent) : QWidget(parent) {
10 setMinimumSize(640,480);
11 setMouseTracking(true);
15 ShareboardCanvas::~ShareboardCanvas() {
18 void ShareboardCanvas::setModel(Shareboard* b) {
22 void ShareboardCanvas::mouseMoveEvent(QMouseEvent* event) {
23 // Send mouse move event to network thread
24 emit mouseMovedTo(event->posF());
25 // If the button is down
27 emit segmentDrawn(dragPath.last(), event->posF());
28 dragPath.append(event->posF());
34 void ShareboardCanvas::mousePressEvent(QMouseEvent* event) {
35 if(event->button() & Qt::LeftButton) {
37 dragPath.append(event->posF()); // We're starting a new drag path
42 void ShareboardCanvas::mouseReleaseEvent(QMouseEvent* event) {
43 if(event->button() & Qt::LeftButton) {
45 qDebug() << dragPath.size() << "mouse move events counted this drag";
46 // Depending on the tool, we now dispatch different types of events
47 dragPath.clear(); // Clear the path; we're no longer tracking a drag
51 void ShareboardCanvas::paintEvent(QPaintEvent* event) {
54 // Paint the background from the saved state
55 p.drawImage(0, 0, board->view());
56 //qDebug() << "ShareboardCanvas:" << board->view().rect();
57 //qDebug() << "ShareboardCanvas:" << board->viewIndex;
58 // Now paint our local changes on top of it
61 // Now paint the set of mouse cursors on top of that