some fixes

Wed, 25 Apr 2018 18:55:15 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 25 Apr 2018 18:55:15 +0300
changeset 1384
4c134708be05
parent 1383
2e7ffaf6239f
child 1385
2f18c0da749d
child 1386
c59dac18b06b

some fixes

src/lddocument.cpp file | annotate | diff | comparison | revisions
src/widgets/headeredit.cpp file | annotate | diff | comparison | revisions
--- a/src/lddocument.cpp	Thu Apr 05 22:56:37 2018 +0300
+++ b/src/lddocument.cpp	Wed Apr 25 18:55:15 2018 +0300
@@ -450,6 +450,7 @@
 {
 	if (m_needsRecache)
 	{
+		this->m_polygonData.clear();
 		Model model {m_documents};
 		this->inlineContents(model, true, true);
 
--- a/src/widgets/headeredit.cpp	Thu Apr 05 22:56:37 2018 +0300
+++ b/src/widgets/headeredit.cpp	Wed Apr 25 18:55:15 2018 +0300
@@ -18,6 +18,7 @@
 
 #include "headeredit.h"
 #include "ui_headeredit.h"
+#include "parser.h"
 #include "../lddocument.h"
 #include "../headerhistorymodel.h"
 
@@ -36,6 +37,14 @@
 	"Wing", "Znap",
 };
 
+LDHeader::FileType headerTypeCast(int index)
+{
+	if (Parser::typeStrings.values().contains(static_cast<LDHeader::FileType>(index)))
+		return static_cast<LDHeader::FileType>(index);
+	else
+		return LDHeader::NoHeader;
+}
+
 HeaderEdit::HeaderEdit(QWidget* parent) :
 	QWidget {parent},
 	ui {*new Ui_HeaderEdit},
@@ -96,6 +105,15 @@
 		}
 	);
 	connect(
+		ui.type,
+		qOverload<int>(&QComboBox::currentIndexChanged),
+		[&](int index)
+		{
+			if (this->hasValidHeader())
+				this->m_header->type = headerTypeCast(index + 1);
+		}
+	);
+	connect(
 		ui.alias,
 		&QCheckBox::stateChanged,
 		[&](int state)

mercurial