subsurface/qt-ui/diveplanner.cpp
Tomaz Canabrava 0d45c77572 Make double click work to put new items on the canvas.
Make double click work to put new items on the canvas.
Those items right now are QGraphicsEllipseItems, but
it will change to 'draggable' items.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-20 12:37:41 -03:00

23 lines
499 B
C++

#include "diveplanner.h"
#include <QMouseEvent>
DivePlanner* DivePlanner::instance()
{
static DivePlanner *self = new DivePlanner();
return self;
}
DivePlanner::DivePlanner(QWidget* parent): QGraphicsView(parent)
{
setScene( new QGraphicsScene());
scene()->setSceneRect(0,0,100,100);
}
void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event)
{
QGraphicsEllipseItem *item = new QGraphicsEllipseItem(-10,-10,20,20);
item->setPos( mapToScene(event->pos()));
scene()->addItem(item);
}