src/hierarchyelement.cpp

Sat, 05 Sep 2015 23:03:24 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sat, 05 Sep 2015 23:03:24 +0300
changeset 978
4603d8fd063e
parent 974
b2fa5f89798a
child 985
ed7b31b9f904
permissions
-rw-r--r--

Make documents members of the main window

#include <stdio.h>
#include <QMetaObject>
#include "hierarchyelement.h"
#include "mainwindow.h"
#include "guiutilities.h"

HierarchyElement::HierarchyElement (QObject* parent) :
	m_window (nullptr),
	m_config (nullptr)
{
	if (parent)
	{
		while (parent->parent() != nullptr)
			parent = parent->parent();

		m_window = qobject_cast<MainWindow*> (parent);
	}

	if (m_window == nullptr)
	{
		m_window = g_win;
		print ("WARNING: Hierarchy element instance %p should be in the hierarchy of a "
			"MainWindow but isn't.\n", this);
	}

	m_config = m_window->configBag();
}

GuiUtilities* HierarchyElement::guiUtilities() const
{
	return m_window->guiUtilities();
}

LDDocument* HierarchyElement::currentDocument()
{
	return m_window->currentDocument();
}

const LDObjectList& HierarchyElement::selectedObjects()
{
	return m_window->selectedObjects();
}

mercurial