Element editor : clean some code

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3476 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-11-10 22:57:32 +00:00
parent e8d6d4de5d
commit 848be587e3
7 changed files with 29 additions and 50 deletions

View File

@@ -60,7 +60,7 @@ bool ESEventAddEllipse::mousePressEvent(QGraphicsSceneMouseEvent *event) {
//Add ellipse to scene
m_ellipse -> setRect(m_ellipse -> rect().normalized());
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Rectangle"), m_scene, m_ellipse));
m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Ellipse"), m_scene, m_ellipse));
//Set m_ellipse to nullptr for create new ellipse at next mouse press
m_ellipse = nullptr;

View File

@@ -28,8 +28,14 @@ ESEventInterface::ESEventInterface(ElementScene *scene) :
m_running (false),
m_abort (false)
{
init();
}
void ESEventInterface::init() {
foreach (QGraphicsView *qgv, m_scene->views())
qgv->setContextMenuPolicy(Qt::NoContextMenu);
m_editor->slot_setNoDragToView();
}
ESEventInterface::~ESEventInterface() {
@@ -38,6 +44,8 @@ ESEventInterface::~ESEventInterface() {
foreach (QGraphicsView *qgv, m_scene->views())
qgv->setContextMenuPolicy(Qt::DefaultContextMenu);
m_editor->slot_setRubberBandToView();
}
bool ESEventInterface::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) {

View File

@@ -32,6 +32,8 @@ class ESEventInterface
ESEventInterface(ElementScene *scene);
virtual ~ESEventInterface();
void init();
virtual bool mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event);
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);