src/objecttypes/modelobject.h

changeset 6
73e448b2943d
parent 3
55a55a9ec2c2
child 8
44679e468ba9
equal deleted inserted replaced
5:593a658cba8e 6:73e448b2943d
2 #include <QPointF> 2 #include <QPointF>
3 #include <QString> 3 #include <QString>
4 #include <QStringView> 4 #include <QStringView>
5 #include "main.h" 5 #include "main.h"
6 #include "colors.h" 6 #include "colors.h"
7 #include "uuid.h"
8 #include "vertex.h" 7 #include "vertex.h"
9 8
10 namespace modelobjects 9 namespace modelobjects
11 { 10 {
12 enum class Property; 11 enum class Property;
40 InvalidValue 39 InvalidValue
41 }; 40 };
42 BaseObject(); 41 BaseObject();
43 BaseObject(const BaseObject&) = delete; 42 BaseObject(const BaseObject&) = delete;
44 virtual ~BaseObject(); 43 virtual ~BaseObject();
45 const Uuid id; 44 const unsigned int id;
46 //virtual void toString(QTextStream &out) = 0; 45 //virtual void toString(QTextStream &out) = 0;
47 virtual bool hasColor() const; 46 virtual bool hasColor() const;
48 virtual QVariant getProperty(Property id) const; 47 virtual QVariant getProperty(Property id) const;
49 virtual SetPropertyResult setProperty(Property id, const QVariant& value); 48 virtual SetPropertyResult setProperty(Property id, const QVariant& value);
49 virtual QString textRepresentation() const = 0;
50 virtual QBrush textRepresentationForeground() const;
51 virtual QBrush textRepresentationBackground() const;
52 virtual QFont textRepresentationFont() const;
50 }; 53 };
51 54
52 class modelobjects::ColoredBaseObject : public BaseObject 55 class modelobjects::ColoredBaseObject : public BaseObject
53 { 56 {
54 public: 57 public:
57 QVariant getProperty(Property id) const override; 60 QVariant getProperty(Property id) const override;
58 SetPropertyResult setProperty(Property id, const QVariant& value) override; 61 SetPropertyResult setProperty(Property id, const QVariant& value) override;
59 private: 62 private:
60 Color color_index = colors::main; 63 Color color_index = colors::main;
61 }; 64 };
65
66 namespace modelobjects
67 {
68 using Id = std::remove_const_t<decltype(BaseObject::id)>;
69 }

mercurial