added comment editing

Sun, 18 Mar 2018 23:31:15 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 18 Mar 2018 23:31:15 +0200
changeset 1300
609b75b026c4
parent 1299
b692088dc1a6
child 1301
4a4e9fb9da76

added comment editing

src/guiutilities.cpp file | annotate | diff | comparison | revisions
src/toolsets/basictoolset.cpp file | annotate | diff | comparison | revisions
--- a/src/guiutilities.cpp	Sun Mar 18 12:37:40 2018 +0200
+++ b/src/guiutilities.cpp	Sun Mar 18 23:31:15 2018 +0200
@@ -19,12 +19,14 @@
 #include <QComboBox>
 #include <QPainter>
 #include <QPushButton>
+#include <QInputDialog>
 #include "colors.h"
 #include "guiutilities.h"
 #include "lddocument.h"
 #include "dialogs/colorselector.h"
 #include "mainwindow.h"
 #include "linetypes/modelobject.h"
+#include "linetypes/comment.h"
 #include "dialogs/subfilereferenceeditor.h"
 #include "widgets/vertexobjecteditor.h"
 
@@ -179,6 +181,17 @@
 		editor.setPrimitivesTree(parent->primitives());
 		editor.exec();
 	}
+	else if (object->type() == LDObjectType::Comment)
+	{
+		LDComment* comment = static_cast<LDComment*>(object);
+		comment->setText(QInputDialog::getText(
+			parent,
+			QObject::tr("Edit comment"),
+			QObject::tr("Comment text:"),
+			QLineEdit::Normal,
+			comment->text()
+		));
+	}
 	else
 	{
 		VertexObjectEditor editor {object, parent};
--- a/src/toolsets/basictoolset.cpp	Sun Mar 18 12:37:40 2018 +0200
+++ b/src/toolsets/basictoolset.cpp	Sun Mar 18 23:31:15 2018 +0200
@@ -24,6 +24,7 @@
 #include <QVBoxLayout>
 #include "../canvas.h"
 #include "../lddocument.h"
+#include "../linetypes/comment.h"
 #include "../linetypes/modelobject.h"
 #include "../linetypes/triangle.h"
 #include "../linetypes/quadrilateral.h"
@@ -327,7 +328,7 @@
 
 void BasicToolset::newComment()
 {
-	// TODO:
+	createObject<LDComment>(this->m_window);
 }
 
 void BasicToolset::newBFC()

mercurial