File indexing completed on 2024-04-28 04:41:47

0001 /***************************************************************************
0002  *   Copyright (C) 2017 by Emmanuel Lepage Vallee                          *
0003  *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@kde.org>             *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 3 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
0017  **************************************************************************/
0018 #ifndef KQUICKITEMVIEWS_DECORATIONADAPTER_H
0019 #define KQUICKITEMVIEWS_DECORATIONADAPTER_H
0020 
0021 // Qt
0022 #include <QQuickPaintedItem>
0023 #include <QtGui/QPixmap>
0024 #include <QtGui/QIcon>
0025 
0026 class DecorationAdapterPrivate;
0027 
0028 class DecorationAdapter : public QQuickPaintedItem
0029 {
0030    Q_OBJECT
0031    Q_PROPERTY(QVariant pixmap READ pixmap WRITE setPixmap NOTIFY changed)
0032    Q_PROPERTY(QString themeFallback READ themeFallback WRITE setThemeFallback NOTIFY changed)
0033    Q_PROPERTY(bool hasPixmap READ hasPixmap NOTIFY changed)
0034 
0035 public:
0036     explicit DecorationAdapter(QQuickItem* parent = nullptr);
0037     virtual ~DecorationAdapter();
0038 
0039     QPixmap pixmap() const;
0040     void setPixmap(const QVariant& var);
0041 
0042     QString themeFallback() const;
0043     void setThemeFallback(const QString& s);
0044 
0045     bool hasPixmap() const;
0046 
0047     virtual void paint(QPainter *painter) override;
0048 
0049 Q_SIGNALS:
0050     void changed();
0051 
0052 private:
0053     DecorationAdapterPrivate *d_ptr;
0054     Q_DECLARE_PRIVATE(DecorationAdapter)
0055 };
0056 
0057 #endif