同步操作将从 梦起丶/HuskarUI 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "delrectangle.h"#include <QPainter>#include <QPainterPath>#include <private/qqmlglobal_p.h>class DelRectanglePrivate{public:QColor m_color = { 0xffffff };DelPen *m_pen = nullptr;qreal m_radius = 0;qreal m_topLeftRadius = 0;qreal m_topRightRadius = 0;qreal m_bottomLeftRadius = 0;qreal m_bottomRightRadius = 0;};DelRectangle::DelRectangle(QQuickItem *parent): QQuickPaintedItem{parent}, d_ptr(new DelRectanglePrivate){}DelRectangle::~DelRectangle(){}qreal DelRectangle::radius() const{Q_D(const DelRectangle);return d->m_radius;}void DelRectangle::setRadius(qreal radius){Q_D(DelRectangle);if (d->m_radius != radius) {d->m_radius = radius;d->m_topLeftRadius = radius;d->m_topRightRadius = radius;d->m_bottomLeftRadius = radius;d->m_bottomRightRadius = radius;emit radiusChanged();update();}}qreal DelRectangle::topLeftRadius() const{Q_D(const DelRectangle);return d->m_topLeftRadius;}void DelRectangle::setTopLeftRadius(qreal radius){Q_D(DelRectangle);if (d->m_topLeftRadius != radius) {d->m_topLeftRadius = radius;emit topLeftRadiusChanged();update();}}qreal DelRectangle::topRightRadius() const{Q_D(const DelRectangle);return d->m_topRightRadius;}void DelRectangle::setTopRightRadius(qreal radius){Q_D(DelRectangle);if (d->m_topRightRadius != radius) {d->m_topRightRadius = radius;emit topRightRadiusChanged();update();}}qreal DelRectangle::bottomLeftRadius() const{Q_D(const DelRectangle);return d->m_bottomLeftRadius;}void DelRectangle::setBottomLeftRadius(qreal radius){Q_D(DelRectangle);if (d->m_bottomLeftRadius != radius) {d->m_bottomLeftRadius = radius;emit bottomLeftRadiusChanged();update();}}qreal DelRectangle::bottomRightRadius() const{Q_D(const DelRectangle);return d->m_bottomRightRadius;}void DelRectangle::setBottomRightRadius(qreal radius){Q_D(DelRectangle);if (d->m_bottomRightRadius != radius) {d->m_bottomRightRadius = radius;emit bottomRightRadiusChanged();update();}}QColor DelRectangle::color() const{Q_D(const DelRectangle);return d->m_color;}void DelRectangle::setColor(QColor color){Q_D(DelRectangle);if (d->m_color != color) {d->m_color = color;emit colorChanged();update();}}DelPen *DelRectangle::border(){Q_D(DelRectangle);if (!d->m_pen) {d->m_pen = new DelPen;QQml_setParent_noEvent(d->m_pen, this);connect(d->m_pen, &DelPen::colorChanged, this, [this]{ update(); });connect(d->m_pen, &DelPen::widthChanged, this, [this]{ update(); });connect(d->m_pen, &DelPen::styleChanged, this, [this]{ update(); });update();}return d->m_pen;}void DelRectangle::paint(QPainter *painter){Q_D(DelRectangle);painter->save();painter->setRenderHint(QPainter::Antialiasing);QRectF rect = boundingRect();if (d->m_pen && d->m_pen->isValid()) {rect = boundingRect();if (rect.width() > d->m_pen->width() * 2) {auto dx = d->m_pen->width() * 0.5;rect.adjust(dx, 0, -dx, 0);}if (rect.height() > d->m_pen->width() * 2) {auto dy = d->m_pen->width() * 0.5;rect.adjust(0, dy, 0, -dy);}painter->setPen(QPen(d->m_pen->color(), d->m_pen->width(), Qt::PenStyle(d->m_pen->style()), Qt::SquareCap, Qt::SvgMiterJoin));} else {painter->setPen(QPen(Qt::transparent));}QPainterPath path;path.moveTo(rect.bottomRight() - QPointF(0, d->m_bottomRightRadius));path.lineTo(rect.topRight() + QPointF(0, d->m_topRightRadius));path.arcTo(QRectF(QPointF(rect.topRight() - QPointF(d->m_topRightRadius * 2, 0)),QSize(d->m_topRightRadius * 2, d->m_topRightRadius * 2)), 0, 90);path.lineTo(rect.topLeft() + QPointF(d->m_topLeftRadius, 0));path.arcTo(QRectF(QPointF(rect.topLeft()), QSize(d->m_topLeftRadius * 2, d->m_topLeftRadius * 2)), 90, 90);path.lineTo(rect.bottomLeft() - QPointF(0, d->m_bottomLeftRadius));path.arcTo(QRectF(QPointF(rect.bottomLeft().x(), rect.bottomLeft().y() - d->m_bottomLeftRadius * 2),QSize(d->m_bottomLeftRadius * 2, d->m_bottomLeftRadius * 2)), 180, 90);path.lineTo(rect.bottomRight() - QPointF(d->m_bottomRightRadius, 0));path.arcTo(QRectF(QPointF(rect.bottomRight() - QPointF(d->m_bottomRightRadius * 2, d->m_bottomRightRadius * 2)),QSize(d->m_bottomRightRadius * 2, d->m_bottomRightRadius * 2)), 270, 90);painter->setBrush(d->m_color);painter->drawPath(path);painter->restore();}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。