Marble

LabelGraphicsItem.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2009 Bastian Holst <[email protected]>
4 //
5 
6 #ifndef MARBLE_LABELGRAPHICSITEM_H
7 #define MARBLE_LABELGRAPHICSITEM_H
8 
9 // Marble
10 #include "FrameGraphicsItem.h"
11 #include "marble_export.h"
12 
13 #include <QSize>
14 
15 class QImage;
16 class QIcon;
17 
18 namespace Marble
19 {
20 
21 class LabelGraphicsItemPrivate;
22 
23 /**
24  * A label item provides an Item that displays text or images/pixmaps.
25  * The text is displayed as plain text.
26  * The item also provides frames.
27  */
28 class MARBLE_EXPORT LabelGraphicsItem : public FrameGraphicsItem
29 {
30  public:
31  explicit LabelGraphicsItem( MarbleGraphicsItem *parent = nullptr );
32  ~LabelGraphicsItem() override;
33 
34  void setContentSize( const QSizeF &contentSize ) override;
35 
36  QString text() const;
37  void setText( const QString& text );
38 
39  QImage image() const;
40  void setImage( const QImage& image, const QSize& size = QSize() );
41 
42  QIcon icon() const;
43  void setIcon( const QIcon& icon, const QSize& size );
44 
45  void setMinimumSize( const QSizeF& size );
46  QSizeF minimumSize() const;
47 
48  void clear();
49 
50  protected:
51  void paintContent( QPainter *painter ) override;
52 
53  private:
54  Q_DISABLE_COPY( LabelGraphicsItem )
55  Q_DECLARE_PRIVATE(LabelGraphicsItem)
56 };
57 
58 } // namespace Marble
59 
60 #endif
Binds a QML item to a specific geodetic location in screen coordinates.
A label item provides an Item that displays text or images/pixmaps.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 03:50:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.