Made the GL renderer recieve information of object deletion via signals.

Thu, 23 Feb 2017 20:06:22 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 23 Feb 2017 20:06:22 +0200
changeset 1158
35ceb74fe53e
parent 1157
1d6d244bdabd
child 1159
6ad8cdcd88d9

Made the GL renderer recieve information of object deletion via signals.

src/glrenderer.cpp file | annotate | diff | comparison | revisions
src/glrenderer.h file | annotate | diff | comparison | revisions
src/linetypes/modelobject.cpp file | annotate | diff | comparison | revisions
--- a/src/glrenderer.cpp	Thu Feb 23 20:03:31 2017 +0200
+++ b/src/glrenderer.cpp	Thu Feb 23 20:06:22 2017 +0200
@@ -71,6 +71,7 @@
 	m_toolTipTimer->setSingleShot (true);
 	setAcceptDrops (true);
 	connect (m_toolTipTimer, SIGNAL (timeout()), this, SLOT (showCameraIconTooltip()));
+	connect(model, SIGNAL(aboutToRemoveObject(LDObject*)), this, SLOT(removeObject(LDObject*)));
 	resetAllAngles();
 	m_needZoomToFit = true;
 
@@ -783,9 +784,9 @@
 
 // =============================================================================
 //
-void GLRenderer::forgetObject(LDObject* obj)
+void GLRenderer::removeObject(LDObject* object)
 {
-	if (m_objectAtCursor == obj)
+	if (m_objectAtCursor == object)
 		m_objectAtCursor = nullptr;
 }
 
--- a/src/glrenderer.h	Thu Feb 23 20:03:31 2017 +0200
+++ b/src/glrenderer.h	Thu Feb 23 20:06:22 2017 +0200
@@ -83,7 +83,6 @@
 	GLCamera& currentCamera();
 	const GLCamera& currentCamera() const;
 	void drawGLScene();
-	void forgetObject(LDObject* obj);
 	void highlightCursorObject();
 	void initGLData();
 	bool isPicking() const;
@@ -173,6 +172,7 @@
 	void drawVbos (VboClass surface, VboSubclass colors, GLenum type);
 	void zoomToFit();
 	void zoomAllToFit();
+	Q_SLOT void removeObject(LDObject* object);
 
 private slots:
 	void showCameraIconTooltip();
--- a/src/linetypes/modelobject.cpp	Thu Feb 23 20:03:31 2017 +0200
+++ b/src/linetypes/modelobject.cpp	Thu Feb 23 20:06:22 2017 +0200
@@ -70,10 +70,6 @@
 
 LDObject::~LDObject()
 {
-	// Delete the GL lists
-	if (g_win)
-		g_win->renderer()->forgetObject(this);
-
 	// Remove this object from the list of LDObjects
 	g_allObjects.erase(g_allObjects.find(id()));
 }

mercurial