[qet] [3563] Diagram view : diagram isn't anymore optional in constructor

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


Revision: 3563
Author:   blacksun
Date:     2014-12-21 13:15:45 +0100 (Sun, 21 Dec 2014)
Log Message:
-----------
Diagram view : diagram isn't anymore optional in constructor

Modified Paths:
--------------
    trunk/sources/diagramview.cpp
    trunk/sources/diagramview.h

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2014-12-19 19:55:53 UTC (rev 3562)
+++ trunk/sources/diagramview.cpp	2014-12-21 12:15:45 UTC (rev 3563)
@@ -48,11 +48,14 @@
 	@param diagram Schema a afficher ; si diagram vaut 0, un nouveau Diagram est utilise
 	@param parent Le QWidget parent de cette vue de schema
 */
-DiagramView::DiagramView(Diagram *diagram, QWidget *parent) : QGraphicsView(parent) {
+DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
+	QGraphicsView     (parent),
+	scene             (diagram),
+	m_event_interface (nullptr)
+{
 	grabGesture(Qt::PinchGesture);
 	setAttribute(Qt::WA_DeleteOnClose, true);
 	setInteractive(true);
-	m_event_interface = nullptr;
 
 	QString whatsthis = tr(
 		"Ceci est la zone dans laquelle vous concevez vos sch\351mas en y ajoutant"
@@ -67,7 +70,6 @@
 	setRenderHint(QPainter::TextAntialiasing, true);
 	setRenderHint(QPainter::SmoothPixmapTransform, true);
 	
-	scene = diagram ? diagram : new Diagram(this);
 	setScene(scene);
 	scene -> undoStack().setClean();
 	setWindowIcon(QET::Icons::QETLogo);

Modified: trunk/sources/diagramview.h
===================================================================
--- trunk/sources/diagramview.h	2014-12-19 19:55:53 UTC (rev 3562)
+++ trunk/sources/diagramview.h	2014-12-21 12:15:45 UTC (rev 3563)
@@ -33,28 +33,29 @@
 class DiagramView : public QGraphicsView {
 	Q_OBJECT
 	
-	// constructors, destructor
+		// constructors, destructor
 	public:
-	DiagramView(Diagram * = 0, QWidget * = 0);
-	virtual ~DiagramView();
+		DiagramView(Diagram *diagram, QWidget * = 0);
+		virtual ~DiagramView();
 
 	private:
-	DiagramView(const DiagramView &);
+		DiagramView(const DiagramView &);
 	
-	// attributes
-	private:
-	Diagram *scene;
-	QMenu *context_menu;
-	QAction *paste_here;
-	QAction *find_element_;
-	QPoint paste_here_pos;
-	bool fresh_focus_in_;               ///< Indicate the focus was freshly gained
-	ElementsLocation next_location_;
-	QPoint next_position_;
-	QPointF center_view_;
-	QPointF rubber_band_origin;
-	DVEventInterface *m_event_interface;
-	
+		// attributes
+
+		Diagram          *scene;
+		DVEventInterface *m_event_interface;
+		QMenu            *context_menu;
+		QAction          *paste_here;
+		QAction          *find_element_;
+		QPoint            paste_here_pos;
+		QPoint            next_position_;
+		QPointF           center_view_;
+		QPointF           rubber_band_origin;
+		bool              fresh_focus_in_;    ///< Indicate the focus was freshly gained
+		ElementsLocation  next_location_;
+
+
 	// methods
 	public:
 	QString title() const;


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