首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏跟Qt君学编程

    Qt自绘-冰墩墩

    { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); QPainterPath 270); path0.cubicTo(331, 284, 354, 284, 367, 271); painter.drawPath(path0); QPainterPath 270); painter.drawPath(path1); painter.setPen(QPen(QColor("#2f4f4f"), 1)); QPainterPath 238); path2.cubicTo(253, 270, 316, 266, 296, 218); painter.drawPath(path2); QPainterPath 237); path3.cubicTo(254, 199, 293, 212, 296, 217); painter.drawPath(path3); QPainterPath

    35610编辑于 2023-03-17
  • 来自专栏全栈程序员必看

    QTreeView实现圆角样式

    更正此处错误描述并更新 QPainterPath TreeViewStyle::roundedPath(const QStyleOptionViewItem *o, const QWidget *w) QPainterPath roundedPath(const QStyleOptionViewItem *opt, const QWidget *w) const; 用法 QTreeView view break; default: QProxyStyle::drawPrimitive(pe, opt, p, w); break; } } QPainterPath , Dtk::Widget::DStyle::PM_FrameRadius, o, w); //用于获取部件设置的圆角大小,非Dtk用户请直接设置radius的值,Dtk中默认为8 QPainterPath const QStyleOptionViewItem *>(opt)) { p->setRenderHint(QPainter::Antialiasing); QPainterPath

    2K20编辑于 2022-09-06
  • 来自专栏Qt项目实战

    Qt开源作品7-高亮按钮控件

    return; } int radius = 80; painter->save(); painter->setPen(Qt::NoPen); QPainterPath smallCircle; QPainterPath bigCircle; radius -= 1; smallCircle.addEllipse(-radius, -radius bigCircle.addEllipse(-radius, -radius + 140, radius * 2, radius * 2); //高光的形状为小圆扣掉大圆的部分 QPainterPath

    82840发布于 2020-05-12
  • 来自专栏日常活动篇

    Qt5实战第五篇:图形与绘图

    矢量图形Qt 支持使用 QPainterPath 类进行矢量图形绘制。QPainterPath 可以存储一系列的图形绘制命令,然后一次性绘制出来,非常适合绘制复杂的图形。 示例代码:#include <QApplication>#include <QWidget>#include <QPainter>#include <QPainterPath>class MyWidget {protected: void paintEvent(QPaintEvent *event) override { QPainter painter(this); QPainterPath

    1.1K11编辑于 2024-12-28
  • [pyqt5]pyqt5界面鼠标移动不触发鼠标移动事件

    import QtCore from PyQt5.QtCore import Qt, QPoint from PyQt5.QtGui import QPainter, QPen, QPixmap, QPainterPath self.pixmap.copy() self.cur_x = 0 self.cur_y = 0 def draw(self, painter): path = QPainterPath

    18700编辑于 2025-07-20
  • 来自专栏信息技术博客

    PyQt5渐变圆环水波进度条+透明淡入(多线程信号)

    Qpainter画弧 6.水波进度条(正弦函数) 参考文章 https://blog.csdn.net/weixin_42512684/article/details/105227816…, 主要是我把QPainterPath * self.m_waterOffset # k 表示 y 的偏移量,可理解为进度 k = height *percentage water1 = QPainterPath () water2 = QPainterPath() #起始点 water1.moveTo(5,height) water2.moveTo 1 water1.lineTo(width-5,height) water2.lineTo(width-5,height) totalpath = QPainterPath () water2 = QPainterPath() #起始点 water1.moveTo(5,height) water2.moveTo

    1.5K20编辑于 2023-02-06
  • 来自专栏独行猫a的沉淀积累总结

    Qt自定义控件之仪表盘的完整实现

    painter->setPen(framePen); painter->drawEllipse(rectangle); painter->setPen(Qt::NoPen); QPainterPath smallCircle; QPainterPath bigCircle; float radius = radiusOuter; smallCircle.addEllipse smallCircle; QPainterPath bigCircle; float radius = radiusInner; smallCircle.addEllipse smallCircle; QPainterPath bigCircle; float radius = radiusHalo; smallCircle.addEllipse( radiusHalo); bigCircle.addEllipse(-radius, -radius, radius * 2, radius * 2); //大圆抛去小圆部分 QPainterPath

    3.2K10编辑于 2022-10-04
  • 来自专栏mythsman的个人博客

    Qt中基本的绘图方法

    QPoint(100,300), }; //留几个角度备用 int startAngle=30*16; int spanAngle=120*16; //留一个QPainterPath 备用 QPainterPath path; path.addRect(150,150,100,100); path.moveTo(100,100); path.cubicTo

    1.1K10编辑于 2022-11-14
  • 来自专栏Qt项目实战

    Qt编写自定义控件18-魔法小鱼

    angle - 130); QPointF rightPos = calcPoint(headPos, bodyLen * 0.56, angle + 130); //计算绘制路径 QPainterPath angle + controlAngle + finAngle : angle - controlAngle - finAngle); //计算鱼鳍的路径 QPainterPath path , tailLen * flag, tailAngle + 90); QPointF pos4 = calcPoint(pos, tailLen, tailAngle + 90); QPainterPath 1.5, angle - 90); QPointF pos4 = calcPoint(endPos2, tailWidth - headLen / 1.5, angle + 90); QPainterPath path1.moveTo(pos); path1.lineTo(pos3); path1.lineTo(pos4); path1.lineTo(pos); QPainterPath

    1.1K00发布于 2019-08-23
  • 来自专栏跟Qt君学编程

    往期精选 | 我的挖掘机

    *option, QWidget *widget) { painter->setPen(Qt::black); painter->setBrush(Qt::yellow); QPainterPath *option, QWidget *widget) { painter->setPen(Qt::black); painter->setBrush(Qt::yellow); QPainterPath *option, QWidget *widget) { painter->setPen(Qt::black); painter->setBrush(Qt::yellow); QPainterPath

    44410编辑于 2023-03-17
  • 来自专栏半生瓜のblog

    【QT】QT基本图形绘制

    ---- QPainterPath绘制简单图形 QPainterPath为QPainter类提供一个存储容器,里面包含了所要绘制的内容的集合及绘制顺序,如长方形、多边形、曲线等各种任意图形。 当需要绘制此预先存储在QPainterPath对象中的内容时,只需调用QPainter类的DrawPath()即可,如addRect()加入一个方形,addEllipse加入一个椭圆形,addText( 其中边线的方向是由QPainterPath创建时根据描述的顺序决定的,如果采用addRect()或addPolygon()等函数加入的图形默认为顺时针方向。 QPoint(100,300) }; int startAngle = 30 * 16;//1/16 int spanAngle = 120 * 16; QPainterPath

    1.4K30编辑于 2023-05-13
  • [pyqt5]关于在pyqt5界面上鼠标位置问题

    import QtCore from PyQt5.QtCore import Qt, QPoint from PyQt5.QtGui import QPainter, QPen, QPixmap, QPainterPath self.setMouseTracking(True) self.cur_x = 0 self.cur_y = 0 def draw(self, painter): path = QPainterPath

    24600编辑于 2025-07-20
  • 来自专栏Qt项目实战

    Qt编写自定义控件32-等待进度条控件

    { currentangle = -currentangle; } //绘制八卦大圆1 painter->setBrush(foreground); QPainterPath ); painter->drawPath(pathBig1); //绘制八卦大圆2 painter->setBrush(background); QPainterPath ); painter->drawPath(pathBig2); //绘制八卦小圆1 painter->setBrush(foreground); QPainterPath radiusSmall * 2); painter->drawPath(pathSmall1); //绘制八卦小圆2 painter->setBrush(background); QPainterPath

    1.8K00发布于 2019-08-27
  • 来自专栏Python编程 pyqt matplotlib

    基于图形项的复杂形状和动画--千足虫

    QHBoxLayout, QPushButton, QSlider,QVBoxLayout) from PyQt5.QtGui import (QBrush, QColor,QPainter,QPainterPath ) def boundingRect(self): #包围盒矩形 return Head.Rect def shape(self): path = QPainterPath self.color = color #每节的身体段 self.rect = QRectF(offset, -20, 30, 40) self.path = QPainterPath

    1.9K40发布于 2019-08-14
  • 来自专栏跟Qt君学编程

    Qt官方示例-矢量变形

    这是使用QPainterPath::addText()函数完成的。   

    45120编辑于 2023-03-17
  • 来自专栏嵌入式项目开发

    QT应用编程: Qt自定义界面并提升窗口部件基类

    include <QGraphicsView> #include <QPainter> #include <QPaintEvent> #include <QMouseEvent> #include <QPainterPath

    4K30编辑于 2022-01-07
  • 来自专栏Qt项目实战

    Qt编写自定义控件13-多态进度条

    percent; painter->setPen(Qt::NoPen); painter->setBrush(color1); //计算绘制的区域,需要裁剪圆角部分 QPainterPath percent; painter->setPen(Qt::NoPen); painter->setBrush(color2); //计算绘制的区域,需要裁剪圆角部分 QPainterPath width2; painter->setPen(Qt::NoPen); painter->setBrush(color3); //计算绘制的区域,需要裁剪圆角部分 QPainterPath

    1.6K00发布于 2019-08-23
  • 来自专栏Qt项目实战

    Qt编写自定义控件66-光晕时钟

    绘制光晕文本采用的QPainterPath的addText来实现。 textList; textList << now.toString("MM月dd日yyyy") << now.toString("hh:mm:ss.zzz"); //绘制文本路径 QPainterPath

    1.8K40发布于 2019-10-16
  • 来自专栏四月天的专栏

    Pyqt5:Qpainter绘制基础图形(一)

    100,100,200,200,0*16,120*16) 画弧形: painter.drawArc(100,100,200,200,30*16,120*16) 画路径: path = QPainterPath

    1.6K10编辑于 2023-03-10
  • 来自专栏Qt项目实战

    Qt编写自定义控件41-自定义环形图

    本控件的难点并不是绘制环形或者饼图区域,初学者都会,难点在如何自动精准计算鼠标所在区域,然后高亮突出显示,用的是QPainterPath的contains方法判断当前鼠标在哪个区域,需要在绘制的时候记住该饼图区域的 QPainterPath,然后在mouseMoveEvent中判断,需要开启鼠标捕捉。 int percent; //百分比 QColor color; //背景色 QString text; //文本 QPainterPath

    1.9K20发布于 2019-08-28
领券