mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +01:00
element editor : improve add line
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3454 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -68,6 +68,7 @@ ElementScene::~ElementScene() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_move() {
|
void ElementScene::slot_move() {
|
||||||
behavior = Normal;
|
behavior = Normal;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,6 +76,7 @@ void ElementScene::slot_move() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addRectangle() {
|
void ElementScene::slot_addRectangle() {
|
||||||
behavior = Rectangle;
|
behavior = Rectangle;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,6 +84,7 @@ void ElementScene::slot_addRectangle() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addCircle() {
|
void ElementScene::slot_addCircle() {
|
||||||
behavior = Circle;
|
behavior = Circle;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,6 +92,7 @@ void ElementScene::slot_addCircle() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addEllipse() {
|
void ElementScene::slot_addEllipse() {
|
||||||
behavior = Ellipse;
|
behavior = Ellipse;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,6 +100,7 @@ void ElementScene::slot_addEllipse() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addPolygon() {
|
void ElementScene::slot_addPolygon() {
|
||||||
behavior = Polygon;
|
behavior = Polygon;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +109,7 @@ void ElementScene::slot_addPolygon() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addText() {
|
void ElementScene::slot_addText() {
|
||||||
behavior = Text;
|
behavior = Text;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,6 +117,7 @@ void ElementScene::slot_addText() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addTerminal() {
|
void ElementScene::slot_addTerminal() {
|
||||||
behavior = Terminal;
|
behavior = Terminal;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,6 +125,7 @@ void ElementScene::slot_addTerminal() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addArc() {
|
void ElementScene::slot_addArc() {
|
||||||
behavior = Arc;
|
behavior = Arc;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,6 +133,7 @@ void ElementScene::slot_addArc() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_addTextField() {
|
void ElementScene::slot_addTextField() {
|
||||||
behavior = TextField;
|
behavior = TextField;
|
||||||
|
if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -72,18 +72,6 @@ bool ESEventAddLine::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remove the current line if exist
|
|
||||||
//or finish if no line
|
|
||||||
if (event -> button() == Qt::RightButton) {
|
|
||||||
if (m_line) {
|
|
||||||
delete m_line; m_line = nullptr;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_running = false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,3 +89,17 @@ bool ESEventAddLine::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
|
|||||||
m_line -> setLine(QLineF(m_line->line().p1(), pos));
|
m_line -> setLine(QLineF(m_line->line().p1(), pos));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ESEventAddLine::mouseReleaseEvent
|
||||||
|
* @param event
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool ESEventAddLine::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
|
if (event -> button() == Qt::RightButton) {
|
||||||
|
if (m_line) {delete m_line; m_line = nullptr;}
|
||||||
|
else {m_running = false;}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ class ESEventAddLine : public ESEventInterface
|
|||||||
ESEventAddLine(ElementScene *scene);
|
ESEventAddLine(ElementScene *scene);
|
||||||
virtual ~ESEventAddLine();
|
virtual ~ESEventAddLine();
|
||||||
|
|
||||||
virtual bool mousePressEvent(QGraphicsSceneMouseEvent *event);
|
virtual bool mousePressEvent (QGraphicsSceneMouseEvent *event);
|
||||||
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
|
virtual bool mouseMoveEvent (QGraphicsSceneMouseEvent *event);
|
||||||
|
virtual bool mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PartLine *m_line;
|
PartLine *m_line;
|
||||||
|
|||||||
Reference in New Issue
Block a user