src/hierarchyelement.h

changeset 1159
6ad8cdcd88d9
parent 1073
a0a0d581309b
child 1192
317f4ce38f3f
child 1251
e75cc5bff076
--- a/src/hierarchyelement.h	Thu Feb 23 20:06:22 2017 +0200
+++ b/src/hierarchyelement.h	Thu Feb 23 20:18:39 2017 +0200
@@ -20,14 +20,16 @@
 #include <QObject>
 #include "main.h"
 #include "configuration.h"
+#include "messageLog.h"
+#include "mainwindow.h"
 
-class MainWindow;
 class GuiUtilities;
 class LDDocument;
 class DocumentManager;
 class PrimitiveManager;
 class Grid;
 class MathFunctions;
+class MainWindow;
 
 //
 // Objects that are to take part in the MainWindow's hierarchy multiple-inherit from this class to get a pointer back
@@ -48,6 +50,14 @@
 	// Utility functions
 	QString preferredLicenseText() const;
 
+	// Format and print the given args to the message log.
+	template<typename... Args>
+	void print(QString formatString, Args... args)
+	{
+		formatHelper(formatString, args...);
+		m_window->addMessage(formatString);
+	}
+
 protected:
 	MainWindow* m_window;
 	DocumentManager* m_documents;

mercurial