File indexing completed on 2024-05-12 04:19:36

0001 // SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #ifndef GWENVIEW_DECORATEDTAG_H
0005 #define GWENVIEW_DECORATEDTAG_H
0006 
0007 #include <QLabel>
0008 #include <lib/gwenviewlib_export.h>
0009 
0010 namespace Gwenview
0011 {
0012 class DecoratedTagPrivate;
0013 
0014 /**
0015  * A label with a custom background under it.
0016  *
0017  * TODO: Turn this into a more interactive control and make it look like Manuel's mockup.
0018  * Should probably be turned into a QAbstractButton subclass or something.
0019  */
0020 class GWENVIEWLIB_EXPORT DecoratedTag : public QLabel
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit DecoratedTag(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
0025     explicit DecoratedTag(const QString &text, QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
0026     ~DecoratedTag() override;
0027 
0028 protected:
0029     void changeEvent(QEvent *event) override;
0030     void paintEvent(QPaintEvent *event) override;
0031 
0032 private:
0033     const std::unique_ptr<DecoratedTagPrivate> d_ptr;
0034     Q_DECLARE_PRIVATE(DecoratedTag)
0035 };
0036 
0037 }
0038 
0039 #endif // GWENVIEW_DECORATEDTAG_H