[qet] [3517] Bug fix for terminal primtive : the rotation of terminal isn't save

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3517
Author:   blacksun
Date:     2014-11-25 06:45:50 +0100 (Tue, 25 Nov 2014)
Log Message:
-----------
Bug fix for terminal primtive : the rotation of terminal isn't save

Modified Paths:
--------------
    trunk/sources/editor/esevent/eseventaddterminal.cpp

Modified: trunk/sources/editor/esevent/eseventaddterminal.cpp
===================================================================
--- trunk/sources/editor/esevent/eseventaddterminal.cpp	2014-11-24 22:03:35 UTC (rev 3516)
+++ trunk/sources/editor/esevent/eseventaddterminal.cpp	2014-11-25 05:45:50 UTC (rev 3517)
@@ -62,9 +62,9 @@
 		m_scene -> undoStack().push(new AddPartCommand(QObject::tr("Borne"), m_scene, m_terminal));
 
 		//Set new terminal with same rotation
-		qreal rotation = m_terminal -> rotation();
+		Qet::Orientation ori = m_terminal -> orientation();
 		m_terminal = new PartTerminal(m_editor, 0, m_scene);
-		m_terminal -> setRotation(rotation);
+		m_terminal -> setOrientation(ori);
 		m_terminal -> setPos(m_scene -> snapToGrid(event -> scenePos()));
 
 		return true;
@@ -84,8 +84,24 @@
  */
 bool ESEventAddTerminal::keyPressEvent(QKeyEvent *event) {
 	if (event -> key() == Qt::Key_Space) {
-		m_terminal -> setRotation(m_terminal -> rotation() + 90);
+		switch (m_terminal->orientation()) {
+			case Qet::North :
+				m_terminal -> setOrientation(Qet::East);
+				break;
+			case Qet::East :
+				m_terminal -> setOrientation(Qet::South);
+				break;
+			case Qet::South :
+				m_terminal -> setOrientation(Qet::West);
+				break;
+			case Qet::West :
+				m_terminal -> setOrientation(Qet::North);
+				break;
+			default :
+				m_terminal -> setOrientation(Qet::North);
+				break;
+		}
 		return true;
 	}
-	return false;
+	return (ESEventInterface::keyPressEvent(event));
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/