src/mainwindow.cpp

changeset 1023
9450ac3cd930
parent 1018
49358df9495b
child 1024
67ba0ee049eb
--- a/src/mainwindow.cpp	Tue Feb 16 16:28:44 2016 +0200
+++ b/src/mainwindow.cpp	Tue Feb 16 19:59:43 2016 +0200
@@ -56,6 +56,7 @@
 #include "glCompiler.h"
 #include "documentmanager.h"
 #include "ldobjectiterator.h"
+#include "grid.h"
 
 ConfigOption (bool ColorizeObjectsList = true)
 ConfigOption (QString QuickColorToolbar = "4:25:14:27:2:3:11:1:22:|:0:72:71:15")
@@ -69,6 +70,7 @@
 	m_config(config),
 	m_guiUtilities (new GuiUtilities (this)),
 	m_primitives(new PrimitiveManager(this)),
+	m_grid(new Grid(this)),
 	ui (*new Ui_MainWindow),
 	m_externalPrograms (nullptr),
 	m_settings (makeSettings (this)),
@@ -881,7 +883,10 @@
 // ============================================================================
 void ObjectList::contextMenuEvent (QContextMenuEvent* ev)
 {
-	g_win->spawnContextMenu (ev->globalPos());
+	MainWindow* mainWindow = qobject_cast<MainWindow*>(parent());
+
+	if (mainWindow)
+		mainWindow->spawnContextMenu (ev->globalPos());
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -1329,6 +1334,11 @@
 	return &m_config;
 }
 
+Grid* MainWindow::grid()
+{
+	return m_grid;
+}
+
 // ---------------------------------------------------------------------------------------------------------------------
 //
 ColorToolbarItem::ColorToolbarItem (LDColor color, QToolButton* toolButton) :

mercurial