mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
beadeffaf5
commit
0d45c77572
2 changed files with 14 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
#include "diveplanner.h"
|
||||
#include <QMouseEvent>
|
||||
|
||||
DivePlanner* DivePlanner::instance()
|
||||
{
|
||||
|
@ -8,4 +9,14 @@ DivePlanner* DivePlanner::instance()
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@ class DivePlanner : public QGraphicsView {
|
|||
Q_OBJECT
|
||||
public:
|
||||
static DivePlanner *instance();
|
||||
protected:
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
DivePlanner(QWidget* parent = 0);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue