File indexing completed on 2024-05-05 03:49:47

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
0004 //
0005 
0006 #ifndef MARBLE_LABELGRAPHICSITEM_H
0007 #define MARBLE_LABELGRAPHICSITEM_H
0008 
0009 // Marble
0010 #include "FrameGraphicsItem.h"
0011 #include "marble_export.h"
0012 
0013 #include <QSize>
0014 
0015 class QImage;
0016 class QIcon;
0017 
0018 namespace Marble
0019 {
0020 
0021 class LabelGraphicsItemPrivate;
0022 
0023 /**
0024  * A label item provides an Item that displays text or images/pixmaps.
0025  * The text is displayed as plain text.
0026  * The item also provides frames.
0027  */
0028 class MARBLE_EXPORT LabelGraphicsItem : public FrameGraphicsItem
0029 {
0030  public:
0031     explicit LabelGraphicsItem( MarbleGraphicsItem *parent = nullptr );
0032     ~LabelGraphicsItem() override;
0033 
0034     void setContentSize( const QSizeF &contentSize ) override;
0035 
0036     QString text() const;
0037     void setText( const QString& text );
0038 
0039     QImage image() const;
0040     void setImage( const QImage& image, const QSize& size = QSize() );
0041 
0042     QIcon icon() const;
0043     void setIcon( const QIcon& icon, const QSize& size );
0044 
0045     void setMinimumSize( const QSizeF& size );
0046     QSizeF minimumSize() const;
0047 
0048     void clear();
0049 
0050  protected:
0051     void paintContent( QPainter *painter ) override;
0052 
0053  private:
0054     Q_DISABLE_COPY( LabelGraphicsItem )
0055     Q_DECLARE_PRIVATE(LabelGraphicsItem)
0056 };
0057 
0058 } // namespace Marble
0059 
0060 #endif