16 static unsigned int id = 0; |
16 static unsigned int id = 0; |
17 id += 1; |
17 id += 1; |
18 return id; |
18 return id; |
19 } |
19 } |
20 |
20 |
21 modelobjects::BaseObject::BaseObject() : |
21 linetypes::Object::Object() : |
22 id {getIdForNewObject()} |
22 id {getIdForNewObject()} |
23 { |
23 { |
24 } |
24 } |
25 |
25 |
26 modelobjects::BaseObject::~BaseObject() |
26 linetypes::Object::~Object() |
27 { |
27 { |
28 } |
28 } |
29 |
29 |
30 bool modelobjects::BaseObject::hasColor() const |
30 bool linetypes::Object::hasColor() const |
31 { |
31 { |
32 return false; |
32 return false; |
33 } |
33 } |
34 |
34 |
35 QVariant modelobjects::BaseObject::getProperty(Property id) const |
35 QVariant linetypes::Object::getProperty(Property id) const |
36 { |
36 { |
37 Q_UNUSED(id); |
37 Q_UNUSED(id); |
38 return {}; |
38 return {}; |
39 } |
39 } |
40 |
40 |
41 auto modelobjects::BaseObject::setProperty(Property id, const QVariant& value) |
41 auto linetypes::Object::setProperty(Property id, const QVariant& value) |
42 -> SetPropertyResult |
42 -> SetPropertyResult |
43 { |
43 { |
44 Q_UNUSED(id) |
44 Q_UNUSED(id) |
45 Q_UNUSED(value) |
45 Q_UNUSED(value) |
46 return SetPropertyResult::PropertyNotHandled; |
46 return SetPropertyResult::PropertyNotHandled; |
47 } |
47 } |
48 |
48 |
49 QBrush modelobjects::BaseObject::textRepresentationForeground() const |
49 QBrush linetypes::Object::textRepresentationForeground() const |
50 { |
50 { |
51 return {}; |
51 return {}; |
52 } |
52 } |
53 |
53 |
54 QBrush modelobjects::BaseObject::textRepresentationBackground() const |
54 QBrush linetypes::Object::textRepresentationBackground() const |
55 { |
55 { |
56 return {}; |
56 return {}; |
57 } |
57 } |
58 |
58 |
59 QFont modelobjects::BaseObject::textRepresentationFont() const |
59 QFont linetypes::Object::textRepresentationFont() const |
60 { |
60 { |
61 return {}; |
61 return {}; |
62 } |
62 } |
63 |
63 |
64 modelobjects::ColoredBaseObject::ColoredBaseObject(const Color color_index) : |
64 linetypes::ColoredObject::ColoredObject(const Color color_index) : |
65 color_index{color_index} |
65 colorIndex{color_index} |
66 { |
66 { |
67 } |
67 } |
68 |
68 |
69 bool modelobjects::ColoredBaseObject::hasColor() const |
69 bool linetypes::ColoredObject::hasColor() const |
70 { |
70 { |
71 return true; |
71 return true; |
72 } |
72 } |
73 |
73 |
74 QVariant modelobjects::ColoredBaseObject::getProperty(Property id) const |
74 QVariant linetypes::ColoredObject::getProperty(Property id) const |
75 { |
75 { |
76 switch (id) |
76 switch (id) |
77 { |
77 { |
78 case Property::Color: |
78 case Property::Color: |
79 return color_index.index; |
79 return colorIndex.index; |
80 default: |
80 default: |
81 return BaseObject::getProperty(id); |
81 return Object::getProperty(id); |
82 } |
82 } |
83 } |
83 } |
84 |
84 |
85 auto modelobjects::ColoredBaseObject::setProperty(Property id, const QVariant& value) |
85 auto linetypes::ColoredObject::setProperty(Property id, const QVariant& value) |
86 -> SetPropertyResult |
86 -> SetPropertyResult |
87 { |
87 { |
88 switch (id) |
88 switch (id) |
89 { |
89 { |
90 case Property::Color: |
90 case Property::Color: |
91 { |
91 { |
92 bool ok; |
92 bool ok; |
93 const int value_int = value.toInt(&ok); |
93 const int value_int = value.toInt(&ok); |
94 if (ok) |
94 if (ok) |
95 { |
95 { |
96 color_index.index = value_int; |
96 colorIndex.index = value_int; |
97 return SetPropertyResult::Success; |
97 return SetPropertyResult::Success; |
98 } |
98 } |
99 else |
99 else |
100 { |
100 { |
101 return SetPropertyResult::InvalidValue; |
101 return SetPropertyResult::InvalidValue; |
102 } |
102 } |
103 } |
103 } |
104 default: |
104 default: |
105 return BaseObject::setProperty(id, value); |
105 return Object::setProperty(id, value); |
106 } |
106 } |
107 } |
107 } |
108 |
108 |
109 QString modelobjects::Empty::textRepresentation() const |
109 QString linetypes::Empty::textRepresentation() const |
110 { |
110 { |
111 return ""; |
111 return ""; |
112 } |
112 } |