src/linetypes/metacommand.cpp

changeset 200
ca23936b455b
parent 199
6988973515d2
child 201
5d201ee4a9c3
equal deleted inserted replaced
199:6988973515d2 200:ca23936b455b
1 #include "metacommand.h"
2
3 ldraw::MetaCommand::MetaCommand(QStringView text) :
4 Object{},
5 storedText{text.toString()} {}
6
7 QVariant ldraw::MetaCommand::getProperty(Property property) const
8 {
9 switch (property)
10 {
11 case Property::Text:
12 return storedText;
13 default:
14 return Object::getProperty(property);
15 }
16 }
17
18 void ldraw::MetaCommand::setProperty(ldraw::Object::SetPropertyResult* result, const PropertyKeyValue& pair)
19 {
20 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Text, {this->storedText = value;});
21 BaseClass::setProperty(result, pair);
22 }
23
24 QString ldraw::MetaCommand::textRepresentation() const
25 {
26 return this->storedText;
27 }
28
29 ldraw::Object::Type ldraw::MetaCommand::typeIdentifier() const
30 {
31 return Type::MetaCommand;
32 }
33
34 /**
35 * @brief @overload ldraw::Object::serialize
36 * @param stream
37 * @return stream
38 */
39 QDataStream& ldraw::MetaCommand::serialize(QDataStream& stream) const
40 {
41 return ldraw::Object::serialize(stream) << this->storedText;
42 }
43
44 /**
45 * @brief @overload ldraw::Object::deserialize
46 * @param stream
47 * @return stream
48 */
49 QDataStream& ldraw::MetaCommand::deserialize(QDataStream& stream)
50 {
51 return ldraw::Object::deserialize(stream) >> this->storedText;
52 }
53
54 QString ldraw::MetaCommand::toLDrawCode() const
55 {
56 return "0 " + this->storedText;
57 }
58
59 QString ldraw::MetaCommand::iconName() const
60 {
61 return ":/icons/chatbubble-ellipses-outline.png";
62 }
63
64 QString ldraw::MetaCommand::typeName() const
65 {
66 return QObject::tr("comment");
67 }
68

mercurial