1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 Jochen Becher 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of Qt Creator. 7 ** 8 ** Commercial License Usage 9 ** Licensees holding valid commercial Qt licenses may use this file in 10 ** accordance with the commercial license agreement provided with the 11 ** Software or, alternatively, in accordance with the terms contained in 12 ** a written agreement between you and The Qt Company. For licensing terms 13 ** and conditions see https://www.qt.io/terms-conditions. For further 14 ** information use the contact form at https://www.qt.io/contact-us. 15 ** 16 ** GNU General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU 18 ** General Public License version 3 as published by the Free Software 19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 20 ** included in the packaging of this file. Please review the following 21 ** information to ensure the GNU General Public License requirements will 22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 23 ** 24 ****************************************************************************/ 25 26 #pragma once 27 28 #include "delement.h" 29 30 #include "qmt/infrastructure/uid.h" 31 32 #include <QList> 33 #include <QPointF> 34 #include <QRectF> 35 36 namespace qmt { 37 38 class MObject; 39 40 class QMT_EXPORT DObject : public DElement 41 { 42 public: 43 enum VisualPrimaryRole { 44 PrimaryRoleNormal, 45 DeprecatedPrimaryRoleLighter, 46 DeprecatedPrimaryRoleDarker, 47 DeprecatedPrimaryRoleSoften, 48 DeprecatedPrimaryRoleOutline, 49 PrimaryRoleCustom1, 50 PrimaryRoleCustom2, 51 PrimaryRoleCustom3, 52 PrimaryRoleCustom4, 53 PrimaryRoleCustom5 54 }; 55 56 enum VisualSecondaryRole { 57 SecondaryRoleNone, 58 SecondaryRoleLighter, 59 SecondaryRoleDarker, 60 SecondaryRoleSoften, 61 SecondaryRoleOutline, 62 SecondaryRoleFlat 63 }; 64 65 enum StereotypeDisplay { 66 StereotypeNone, 67 StereotypeLabel, 68 StereotypeDecoration, 69 StereotypeIcon, 70 StereotypeSmart 71 }; 72 73 DObject(); 74 DObject(const DObject &); 75 ~DObject() override; 76 77 DObject &operator=(const DObject &rhs); 78 modelUid()79 Uid modelUid() const override { return m_modelUid; } 80 void setModelUid(const Uid &uid); stereotypes()81 QList<QString> stereotypes() const { return m_stereotypes; } 82 void setStereotypes(const QList<QString> &stereotypes); context()83 QString context() const { return m_context; } 84 void setContext(const QString &context); name()85 QString name() const { return m_name; } 86 void setName(const QString &name); pos()87 QPointF pos() const { return m_pos; } 88 void setPos(const QPointF &pos); rect()89 QRectF rect() const { return m_rect; } 90 void setRect(const QRectF &rect); depth()91 int depth() const { return m_depth; } 92 void setDepth(int depth); visualPrimaryRole()93 VisualPrimaryRole visualPrimaryRole() const { return m_visualPrimaryRole; } 94 void setVisualPrimaryRole(VisualPrimaryRole visualPrimaryRole); visualSecondaryRole()95 VisualSecondaryRole visualSecondaryRole() const { return m_visualSecondaryRole; } 96 void setVisualSecondaryRole(VisualSecondaryRole visualSecondaryRole); stereotypeDisplay()97 StereotypeDisplay stereotypeDisplay() const { return m_stereotypeDisplay; } 98 void setStereotypeDisplay(StereotypeDisplay stereotypeDisplay); isAutoSized()99 bool isAutoSized() const { return m_isAutoSized; } 100 void setAutoSized(bool autoSized); isVisualEmphasized()101 bool isVisualEmphasized() const { return m_isVisualEmphasized; } 102 void setVisualEmphasized(bool visualEmphasized); 103 104 void accept(DVisitor *visitor) override; 105 void accept(DConstVisitor *visitor) const override; 106 107 private: 108 Uid m_modelUid = Uid::invalidUid(); 109 QList<QString> m_stereotypes; 110 QString m_context; 111 QString m_name; 112 QPointF m_pos; 113 QRectF m_rect; 114 int m_depth = 0; 115 VisualPrimaryRole m_visualPrimaryRole = PrimaryRoleNormal; 116 VisualSecondaryRole m_visualSecondaryRole = SecondaryRoleNone; 117 StereotypeDisplay m_stereotypeDisplay = StereotypeSmart; 118 bool m_isAutoSized = true; 119 bool m_isVisualEmphasized = false; 120 }; 121 122 } // namespace qmt 123