Kirigami2

paintedrectangleitem.h
1/*
2 * SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef PAINTEDRECTANGLEITEM_H
8#define PAINTEDRECTANGLEITEM_H
9
10#include <QQuickPaintedItem>
11
12/**
13 * A rectangle with a border and rounded corners, rendered through QPainter.
14 *
15 * This is a helper used by ShadowedRectangle as fallback for when software
16 * rendering is used, which means our shaders cannot be used.
17 *
18 * Since we cannot actually use QSGPaintedNode, we need to do some trickery
19 * using QQuickPaintedItem as a child of ShadowedRectangle.
20 *
21 * \warning This item is **not** intended as a general purpose item.
22 */
24{
26public:
27 explicit PaintedRectangleItem(QQuickItem *parent = nullptr);
28
29 void setColor(const QColor &color);
30 void setRadius(qreal radius);
31 void setBorderColor(const QColor &color);
32 void setBorderWidth(qreal width);
33
34 void paint(QPainter *painter) override;
35
36private:
37 QColor m_color;
38 qreal m_radius = 0.0;
39 QColor m_borderColor;
40 qreal m_borderWidth = 0.0;
41};
42
43#endif // PAINTEDRECTANGLEITEM_H
A rectangle with a border and rounded corners, rendered through QPainter.
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:53:34 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.