[qet] [3477] element editor : clean some code

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


Revision: 3477
Author:   blacksun
Date:     2014-11-11 13:02:08 +0100 (Tue, 11 Nov 2014)
Log Message:
-----------
element editor : clean some code

Modified Paths:
--------------
    trunk/sources/editor/elementscene.cpp
    trunk/sources/editor/elementscene.h
    trunk/sources/editor/elementview.cpp
    trunk/sources/editor/qetelementeditor.cpp

Modified: trunk/sources/editor/elementscene.cpp
===================================================================
--- trunk/sources/editor/elementscene.cpp	2014-11-10 22:57:32 UTC (rev 3476)
+++ trunk/sources/editor/elementscene.cpp	2014-11-11 12:02:08 UTC (rev 3477)
@@ -48,6 +48,7 @@
 	element_editor(editor),
 	decorator_(0)
 {
+	behavior = Normal;
 	setItemIndexMethod(NoIndex);
 	setGrid(1, 1);
 	initPasteArea();
@@ -64,14 +65,6 @@
 }
 
 /**
-	Passe la scene en mode "selection et deplacement de parties"
-*/
-void ElementScene::slot_move() {
-	behavior = Normal;
-	if (m_event_interface) delete m_event_interface; m_event_interface = nullptr;
-}
-
-/**
  * @brief ElementScene::mouseMoveEvent
  * @param e
  */
@@ -87,7 +80,8 @@
 	}
 
 	QPointF event_pos = e -> scenePos();
-	if (mustSnapToGrid(e)) event_pos = snapToGrid(event_pos);
+	if (!e -> modifiers() & Qt::ControlModifier)
+		event_pos = snapToGrid(event_pos);
 	
 	if (behavior == PasteArea) {
 		QRectF current_rect(paste_area_ -> rect());
@@ -958,16 +952,6 @@
 }
 
 /**
-	@param e Evenement souris
-	@return true s'il faut utiliser le snap-to-grid
-	Typiquement, cette methode retourne true si l'evenement souris se produit
-	sans la touche Ctrl enfoncee.
-*/
-bool ElementScene::mustSnapToGrid(QGraphicsSceneMouseEvent *e) {
-	return(!(e -> modifiers() & Qt::ControlModifier));
-}
-
-/**
 	@return true if \a item1's zValue() is less than \a item2's.
 */
 bool ElementScene::zValueLessThan(QGraphicsItem *item1, QGraphicsItem *item2) {

Modified: trunk/sources/editor/elementscene.h
===================================================================
--- trunk/sources/editor/elementscene.h	2014-11-10 22:57:32 UTC (rev 3476)
+++ trunk/sources/editor/elementscene.h	2014-11-11 12:02:08 UTC (rev 3477)
@@ -151,13 +151,11 @@
 	ElementContent addContentAtPos(const ElementContent &, const QPointF &, QString * = 0);
 	void addPrimitive(QGraphicsItem *);
 	void initPasteArea();
-	bool mustSnapToGrid(QGraphicsSceneMouseEvent *);
 	static bool zValueLessThan(QGraphicsItem *, QGraphicsItem *);
 	QMutex *decorator_lock_;
 	void centerElementToOrigine();
 	
 	public slots:
-	void slot_move();
 	void slot_select(const ElementContent &);
 	void slot_selectAll();
 	void slot_deselectAll();

Modified: trunk/sources/editor/elementview.cpp
===================================================================
--- trunk/sources/editor/elementview.cpp	2014-11-10 22:57:32 UTC (rev 3476)
+++ trunk/sources/editor/elementview.cpp	2014-11-11 12:02:08 UTC (rev 3477)
@@ -35,7 +35,6 @@
 	setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
 	zoomReset();
 	connect(scene_, SIGNAL(pasteAreaDefined(const QRectF &)), this, SLOT(pasteAreaDefined(const QRectF &)));
-	connect(scene_, SIGNAL(partsAdded()), this, SLOT(adjustSceneRect()));
 	connect(scene_, SIGNAL(needZoomFit()), this, SLOT(zoomFit()));
 }
 

Modified: trunk/sources/editor/qetelementeditor.cpp
===================================================================
--- trunk/sources/editor/qetelementeditor.cpp	2014-11-10 22:57:32 UTC (rev 3476)
+++ trunk/sources/editor/qetelementeditor.cpp	2014-11-11 12:02:08 UTC (rev 3477)
@@ -486,7 +486,6 @@
 void QETElementEditor::setupInterface() {
 	// editeur
 	ce_scene = new ElementScene(this, this);
-	ce_scene -> slot_move();
 	ce_view = new ElementView(ce_scene, this);
 	slot_setRubberBandToView();
 	setCentralWidget(ce_view);


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