literaldraw
clone your own copy | download snapshot

Snapshots | iceberg

Inside this repository

drawview.cpp
text/x-c++src

Download raw (513 bytes)

#include "drawview.h"
#include <QMouseEvent>
#include <QPoint>
#include <QPointF>

DrawView::DrawView(QWidget *parent) :
    QGraphicsView(parent)
{
}

void DrawView::mouseReleaseEvent(QMouseEvent *event)
{
	QPointF p(mapToScene(event->pos()));
	emit posClick(p.x(), p.y());
}

void DrawView::mouseMoveEvent(QMouseEvent *event)
{
	emit posChanged(event->pos());
}

void DrawView::resizeEvent(QResizeEvent *event)
{
	QGraphicsView::resizeEvent(event);
	emit sizeChanged(0);
//	QGraphicsView::resizeEvent(event);
}