Warning, file /frameworks/kirigami/src/scenegraph/paintedrectangleitem.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef PAINTEDRECTANGLEITEM_H 0008 #define PAINTEDRECTANGLEITEM_H 0009 0010 #include <QQuickPaintedItem> 0011 0012 /** 0013 * A rectangle with a border and rounded corners, rendered through QPainter. 0014 * 0015 * This is a helper used by ShadowedRectangle as fallback for when software 0016 * rendering is used, which means our shaders cannot be used. 0017 * 0018 * Since we cannot actually use QSGPaintedNode, we need to do some trickery 0019 * using QQuickPaintedItem as a child of ShadowedRectangle. 0020 * 0021 * \warning This item is **not** intended as a general purpose item. 0022 */ 0023 class PaintedRectangleItem : public QQuickPaintedItem 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit PaintedRectangleItem(QQuickItem *parent = nullptr); 0028 0029 void setColor(const QColor &color); 0030 void setRadius(qreal radius); 0031 void setBorderColor(const QColor &color); 0032 void setBorderWidth(qreal width); 0033 0034 void paint(QPainter *painter) override; 0035 0036 private: 0037 QColor m_color; 0038 qreal m_radius = 0.0; 0039 QColor m_borderColor; 0040 qreal m_borderWidth = 0.0; 0041 }; 0042 0043 #endif // PAINTEDRECTANGLEITEM_H