5 Star 1 Fork 0

tjss / drawing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
roundrectitem.cpp 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
kitfrankenstein 提交于 2018-12-16 16:39 . 增加插入图片
#include "roundrectitem.h"
RoundRectItem::RoundRectItem(QGraphicsItem *parent) : QGraphicsRectItem (parent)
{
}
RoundRectItem::RoundRectItem(qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parent)
: QGraphicsRectItem (x, y, width, height, parent)
{
// if (width < 0) {
// x = x + width;
// }
// if (height < 0) {
// y = y + height;
// }
// rRect = QGraphicsRectItem::rect();
rRect = QRectF(x, y, width, height);
}
RoundRectItem::RoundRectItem(QRectF &rect, QGraphicsItem *parent)
: QGraphicsRectItem (rect, parent)
{
// qreal x = rect.x();
// qreal y = rect.y();
// qreal width = rect.width();
// qreal height = rect.height();
// if (width < 0) {
// x = x + width;
// }
// if (height < 0) {
// y = y + height;
// }
// rRect = QRectF(x, y, std::abs(width), std::abs(height));
rRect = rect;
}
void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){
Q_UNUSED(option);
Q_UNUSED(widget);
painter->setPen(QGraphicsRectItem::pen());
painter->drawRoundRect(rRect, 30, 30);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tjssqn/drawing.git
git@gitee.com:tjssqn/drawing.git
tjssqn
drawing
drawing
master

搜索帮助