File indexing completed on 2024-05-12 16:44:04

0001 /*
0002     SPDX-FileCopyrightText: 2005 Ace Jones <acejones@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KMYMONEYTITLELABEL_H
0008 #define KMYMONEYTITLELABEL_H
0009 
0010 // ----------------------------------------------------------------------------
0011 // QT Includes
0012 
0013 #include <QLabel>
0014 #include <QColor>
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 // ----------------------------------------------------------------------------
0020 // Project Includes
0021 
0022 /**
0023   * @author ace jones
0024   */
0025 class KMyMoneyTitleLabelPrivate;
0026 class KMyMoneyTitleLabel : public QLabel
0027 {
0028     Q_OBJECT
0029     Q_DISABLE_COPY(KMyMoneyTitleLabel)
0030     Q_PROPERTY(QString leftImageFile READ leftImageFile WRITE setLeftImageFile DESIGNABLE true)
0031     Q_PROPERTY(QString rightImageFile READ rightImageFile WRITE setRightImageFile DESIGNABLE true)
0032     Q_PROPERTY(QColor bgColor READ bgColor WRITE setBgColor DESIGNABLE true)
0033     Q_PROPERTY(QString text READ text WRITE setText DESIGNABLE true)
0034 
0035 public:
0036     explicit KMyMoneyTitleLabel(QWidget* parent = nullptr);
0037     ~KMyMoneyTitleLabel();
0038 
0039     void setBgColor(const QColor& _color);
0040     void setLeftImageFile(const QString& _file);
0041     void setRightImageFile(const QString& _file);
0042 
0043     QString leftImageFile() const;
0044     QString rightImageFile() const;
0045     QColor bgColor() const;
0046     QString text() const;
0047 
0048 public Q_SLOTS:
0049     virtual void setText(const QString& txt);
0050 
0051 protected:
0052     void updatePixmap();
0053     void paintEvent(QPaintEvent *) override;
0054 
0055 private:
0056     KMyMoneyTitleLabelPrivate * const d_ptr;
0057     Q_DECLARE_PRIVATE(KMyMoneyTitleLabel)
0058 };
0059 
0060 #endif