116 lines
3.2 KiB
C++
116 lines
3.2 KiB
C++
#pragma once
|
|
|
|
#include "blobshape.hpp"
|
|
|
|
#include <qqmlengine.h>
|
|
|
|
class BlobInvertedRect : public BlobShape {
|
|
Q_OBJECT
|
|
QML_ELEMENT
|
|
Q_PROPERTY(
|
|
qreal borderLeft READ borderLeft WRITE setBorderLeft NOTIFY
|
|
borderLeftChanged)
|
|
Q_PROPERTY(
|
|
qreal borderRight READ borderRight WRITE setBorderRight NOTIFY
|
|
borderRightChanged)
|
|
Q_PROPERTY(
|
|
qreal borderTop READ borderTop WRITE setBorderTop NOTIFY
|
|
borderTopChanged)
|
|
Q_PROPERTY(
|
|
qreal borderBottom READ borderBottom WRITE setBorderBottom NOTIFY
|
|
borderBottomChanged)
|
|
Q_PROPERTY(
|
|
qreal outerRadius READ outerRadius WRITE setOuterRadius NOTIFY
|
|
outerRadiusChanged)
|
|
Q_PROPERTY(
|
|
qreal outerTopLeftRadius READ outerTopLeftRadius WRITE
|
|
setOuterTopLeftRadius NOTIFY outerTopLeftRadiusChanged)
|
|
Q_PROPERTY(
|
|
qreal outerTopRightRadius READ outerTopRightRadius WRITE
|
|
setOuterTopRightRadius NOTIFY outerTopRightRadiusChanged)
|
|
Q_PROPERTY(
|
|
qreal outerBottomLeftRadius READ outerBottomLeftRadius WRITE
|
|
setOuterBottomLeftRadius NOTIFY outerBottomLeftRadiusChanged)
|
|
Q_PROPERTY(
|
|
qreal outerBottomRightRadius READ outerBottomRightRadius WRITE
|
|
setOuterBottomRightRadius NOTIFY outerBottomRightRadiusChanged)
|
|
|
|
public:
|
|
explicit BlobInvertedRect(QQuickItem* parent = nullptr);
|
|
~BlobInvertedRect() override;
|
|
|
|
[[nodiscard]] qreal borderLeft() const { return m_borderLeft; }
|
|
|
|
void setBorderLeft(qreal v);
|
|
|
|
[[nodiscard]] qreal borderRight() const { return m_borderRight; }
|
|
|
|
void setBorderRight(qreal v);
|
|
|
|
[[nodiscard]] qreal borderTop() const { return m_borderTop; }
|
|
|
|
void setBorderTop(qreal v);
|
|
|
|
[[nodiscard]] qreal borderBottom() const { return m_borderBottom; }
|
|
|
|
void setBorderBottom(qreal v);
|
|
|
|
[[nodiscard]] qreal outerRadius() const { return m_outerRadius; }
|
|
|
|
void setOuterRadius(qreal v);
|
|
|
|
// Per-corner outer radii. -1 falls back to outerRadius (mirrors BlobRect).
|
|
[[nodiscard]] qreal outerTopLeftRadius() const { return m_outerTopLeftRadius; }
|
|
|
|
void setOuterTopLeftRadius(qreal v);
|
|
|
|
[[nodiscard]] qreal outerTopRightRadius() const { return m_outerTopRightRadius; }
|
|
|
|
void setOuterTopRightRadius(qreal v);
|
|
|
|
[[nodiscard]] qreal outerBottomLeftRadius() const {
|
|
return m_outerBottomLeftRadius;
|
|
}
|
|
|
|
void setOuterBottomLeftRadius(qreal v);
|
|
|
|
[[nodiscard]] qreal outerBottomRightRadius() const {
|
|
return m_outerBottomRightRadius;
|
|
}
|
|
|
|
void setOuterBottomRightRadius(qreal v);
|
|
|
|
signals:
|
|
void borderLeftChanged();
|
|
void borderRightChanged();
|
|
void borderTopChanged();
|
|
void borderBottomChanged();
|
|
void outerRadiusChanged();
|
|
void outerTopLeftRadiusChanged();
|
|
void outerTopRightRadiusChanged();
|
|
void outerBottomLeftRadiusChanged();
|
|
void outerBottomRightRadiusChanged();
|
|
|
|
protected:
|
|
[[nodiscard]] bool isInvertedRect() const override { return true; }
|
|
|
|
void outerCornerRadii(float out[4]) const override;
|
|
|
|
QSGNode* updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) override;
|
|
|
|
void registerWithGroup() override;
|
|
void unregisterFromGroup() override;
|
|
|
|
private:
|
|
qreal m_borderLeft = 0;
|
|
qreal m_borderRight = 0;
|
|
qreal m_borderTop = 0;
|
|
qreal m_borderBottom = 0;
|
|
|
|
qreal m_outerRadius = 0;
|
|
qreal m_outerTopLeftRadius = -1;
|
|
qreal m_outerTopRightRadius = -1;
|
|
qreal m_outerBottomLeftRadius = -1;
|
|
qreal m_outerBottomRightRadius = -1;
|
|
};
|