src/objecttypes/comment.cpp

Thu, 03 Oct 2019 23:44:28 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 03 Oct 2019 23:44:28 +0300
changeset 6
73e448b2943d
parent 3
55a55a9ec2c2
child 8
44679e468ba9
permissions
-rw-r--r--

language support

6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
1 #include <QFont>
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 #include "comment.h"
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 modelobjects::Comment::Comment(QStringView text) :
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 BaseObject{},
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 storedText{text.toString()} {}
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 QVariant modelobjects::Comment::getProperty(Property property) const
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 switch (property)
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 case Property::Text:
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 return storedText;
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 default:
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 return BaseObject::getProperty(property);
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 }
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 }
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 auto modelobjects::Comment::setProperty(Property property, const QVariant& value)
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 -> SetPropertyResult
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 switch (property)
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 {
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 case Property::Text:
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 storedText = value.toString();
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 return SetPropertyResult::Success;
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 default:
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 return BaseObject::setProperty(property, value);
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 }
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 }
6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
31
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
32 QString modelobjects::Comment::textRepresentation() const
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
33 {
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
34 return this->storedText;
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
35 }
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
36
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
37 QFont modelobjects::Comment::textRepresentationFont() const
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
38 {
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
39 QFont font;
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
40 font.setItalic(true);
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
41 return font;
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
42 }

mercurial