Marble

FrameGraphicsItem.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
4//
5
6#ifndef MARBLE_FRAMEGRAPHICSITEM_H
7#define MARBLE_FRAMEGRAPHICSITEM_H
8
9// Marble
10#include "marble_export.h"
11#include "ScreenGraphicsItem.h"
12
13#include <Qt> // for Qt::PenStyle
14
15class QBrush;
16class QPainterPath;
17
18namespace Marble
19{
20
21class FrameGraphicsItemPrivate;
22
23class MARBLE_EXPORT FrameGraphicsItem : public ScreenGraphicsItem
24{
25 public:
26 enum FrameType {
27 NoFrame,
28 RectFrame,
29 RoundedRectFrame,
30 ShadowFrame
31 };
32
33 explicit FrameGraphicsItem( MarbleGraphicsItem *parent = nullptr );
34
35 ~FrameGraphicsItem() override;
36
37 /**
38 * Returns the type of the frame.
39 */
40 FrameType frame() const;
41
42 /**
43 * Sets the type of the Frame. Standard is NoFrame.
44 */
45 void setFrame( FrameType type );
46
47 /**
48 * Returns the margin of the item. This is used for all margins with the value 0.0.
49 * The padding is the space outside the painted space.
50 */
51 qreal margin() const;
52
53 /**
54 * Sets the margin of the item. This is used for all margins with the value 0.0.
55 */
56 void setMargin( qreal margin );
57
58 /**
59 * Returns the top margin of the item.
60 */
61 qreal marginTop() const;
62
63 /**
64 * Set the top margin of the item.
65 */
66 void setMarginTop( qreal marginTop );
67
68 /**
69 * Returns the bottom margin of the item.
70 */
71 qreal marginBottom() const;
72
73 /**
74 * Set the bottom margin of the item.
75 */
76 void setMarginBottom( qreal marginBottom );
77
78 /**
79 * Returns the left margin of the item.
80 */
81 qreal marginLeft() const;
82
83 /**
84 * Set the left margin of the item.
85 */
86 void setMarginLeft( qreal marginLeft );
87
88 /**
89 * Returns the right margin of the item.
90 */
91 qreal marginRight() const;
92
93 /**
94 * Set the right margin of the item.
95 */
96 void setMarginRight( qreal marginRight );
97
98 /**
99 * Returns the border width of the item.
100 */
101 qreal borderWidth() const;
102
103 /**
104 * Set the border width of the item.
105 */
106 void setBorderWidth( qreal width );
107
108 /**
109 * Returns the padding of the item.
110 * The padding is the empty space inside the border.
111 */
112 qreal padding() const;
113
114 /**
115 * Set the padding of the item.
116 */
117 void setPadding( qreal width );
118
119 /**
120 * Returns the brush of the border.
121 */
122 QBrush borderBrush() const;
123
124 /**
125 * Change the brush of the border.
126 */
127 void setBorderBrush( const QBrush &brush );
128
129 /**
130 * Returns the style of the border.
131 */
132 Qt::PenStyle borderStyle () const;
133
134 /**
135 * Change the style of the border.
136 */
137 void setBorderStyle( Qt::PenStyle style );
138
139 /**
140 * Returns the background brush of the item.
141 */
142 QBrush background() const;
143
144 /**
145 * Changes the background brush of the item.
146 */
147 void setBackground( const QBrush &background );
148
149 QRectF paintedRect() const;
150
151 QRectF contentRect() const override;
152 QSizeF contentSize() const override;
153
154 /**
155 * Sets the size of the content of the item.
156 * @p size is the size required for contents.
157 */
158 void setContentSize( const QSizeF& size ) override;
159
160 protected:
161 /**
162 * Returns the shape of the background.
163 */
164 virtual QPainterPath backgroundShape() const;
165
166 /**
167 * This function won't be reimplemented in most cases.
168 */
169 void paint( QPainter *painter ) override;
170
171 /**
172 * Here the items paint their content.
173 */
174 virtual void paintContent( QPainter *painter );
175
176 /**
177 * Paints the background. This function won't be reimplemented in most cases.
178 */
179 virtual void paintBackground( QPainter *painter );
180
181 explicit FrameGraphicsItem(FrameGraphicsItemPrivate *dd);
182
183 private:
184 Q_DISABLE_COPY( FrameGraphicsItem )
185 Q_DECLARE_PRIVATE(FrameGraphicsItem)
186};
187
188} // namespace Marble
189
190#endif
Binds a QML item to a specific geodetic location in screen coordinates.
PenStyle
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:50:53 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.