Fluid
Loading...
Searching...
No Matches
cornersgroup.h
Go to the documentation of this file.
1/*
2 * This file is part of Fluid.
3 *
4 * Copyright (C) 2025 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
5 * Copyright (C) 2024-2025 hypengw <hypengwip@gmail.com>
6 *
7 * $BEGIN_LICENSE:MPL2$
8 *
9 * This Source Code Form is subject to the terms of the Mozilla Public
10 * License, v. 2.0. If a copy of the MPL was not distributed with this
11 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 *
13 * $END_LICENSE$
14 */
15
16#pragma once
17
18#include <QQmlEngine>
19#include <QVector4D>
20
21namespace Fluid {
22
24{
25 Q_GADGET
26 QML_VALUE_TYPE(corners)
27 QML_CONSTRUCTIBLE_VALUE
28 Q_PROPERTY(qreal radius READ radius FINAL)
29 Q_PROPERTY(qreal topLeft READ topLeft WRITE setTopLeft FINAL)
30 Q_PROPERTY(qreal topRight READ topRight WRITE setTopRight FINAL)
31 Q_PROPERTY(qreal bottomLeft READ bottomLeft WRITE setBottomLeft FINAL)
32 Q_PROPERTY(qreal bottomRight READ bottomRight WRITE setBottomRight FINAL)
33public:
34 Q_INVOKABLE CornersGroup() noexcept;
35 Q_INVOKABLE CornersGroup(qreal) noexcept;
36 Q_INVOKABLE CornersGroup(qreal topLeft, qreal topRight, qreal bottomLeft,
37 qreal bottomRight) noexcept;
38 ~CornersGroup();
39
40 CornersGroup(const CornersGroup &) = default;
42 CornersGroup &operator=(const CornersGroup &) = default;
43 CornersGroup &operator=(CornersGroup &&) = default;
44
45 qreal radius() const noexcept;
46 void setRadius(qreal) noexcept;
47
48 qreal topLeft() const noexcept;
49 void setTopLeft(qreal newTopLeft) noexcept;
50
51 qreal topRight() const noexcept;
52 void setTopRight(qreal newTopRight) noexcept;
53
54 qreal bottomLeft() const noexcept;
55 void setBottomLeft(qreal newBottomLeft) noexcept;
56
57 qreal bottomRight() const noexcept;
58 void setBottomRight(qreal newBottomRight) noexcept;
59
60 Q_INVOKABLE QVector4D toVector4D() const noexcept;
61 operator QVector4D() const noexcept;
62
63private:
64 qreal m_bottomRight;
65 qreal m_topRight;
66 qreal m_bottomLeft;
67 qreal m_topLeft;
68};
69
70} // namespace Fluid
Represents the corner radii for a rectangular material-design shape.
Definition cornersgroup.h:24
void setRadius(qreal) noexcept
Sets all four corner radii to the same value.
Definition cornersgroup.cpp:111
qreal topLeft
Definition cornersgroup.h:29
Q_INVOKABLE QVector4D toVector4D() const noexcept
Converts the corner radii to a QVector4D.
Definition cornersgroup.cpp:195
void setBottomLeft(qreal newBottomLeft) noexcept
Sets the bottom-left corner radius.
Definition cornersgroup.cpp:168
qreal bottomLeft
Definition cornersgroup.h:31
qreal bottomRight
Definition cornersgroup.h:32
void setBottomRight(qreal newBottomRight) noexcept
Sets the bottom-right corner radius.
Definition cornersgroup.cpp:186
void setTopLeft(qreal newTopLeft) noexcept
Sets the top-left corner radius.
Definition cornersgroup.cpp:132
qreal topRight
Definition cornersgroup.h:30
void setTopRight(qreal newTopRight) noexcept
Sets the top-right corner radius.
Definition cornersgroup.cpp:150
QML_CONSTRUCTIBLE_VALUEqreal radius
Definition cornersgroup.h:28
Definition rectangle.cpp:26