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 <QPointF>
31 #include <QRectF>
32 
33 namespace qmt {
34 
35 class QMT_EXPORT DAnnotation : public DElement
36 {
37 public:
38     enum VisualRole {
39         RoleNormal,
40         RoleTitle,
41         RoleSubtitle,
42         RoleEmphasized,
43         RoleSoften,
44         RoleFootnote
45     };
46 
47     DAnnotation();
48     DAnnotation(const DAnnotation &);
49     ~DAnnotation() override;
50 
51     DAnnotation &operator=(const DAnnotation &);
52 
modelUid()53     Uid modelUid() const override { return Uid::invalidUid(); }
text()54     QString text() const { return m_text; }
55     void setText(const QString &text);
pos()56     QPointF pos() const { return m_pos; }
57     void setPos(const QPointF &pos);
rect()58     QRectF rect() const { return m_rect; }
59     void setRect(const QRectF &rect);
visualRole()60     VisualRole visualRole() const { return m_visualRole; }
61     void setVisualRole(VisualRole visualRole);
isAutoSized()62     bool isAutoSized() const { return m_isAutoSized; }
63     void setAutoSized(bool autoSized);
64 
65     void accept(DVisitor *visitor) override;
66     void accept(DConstVisitor *visitor) const override;
67 
68 private:
69     QString m_text;
70     QPointF m_pos;
71     QRectF m_rect;
72     VisualRole m_visualRole = RoleNormal;
73     bool m_isAutoSized = true;
74 };
75 
76 } // namespace qmt
77