当前位置: 首页 > news >正文

网站建设狼盾网络找建设网站公司吗

网站建设狼盾网络,找建设网站公司吗,成都医疗网站建设,南京网站公司文章目录 前言QPainterPath 与 QPainter 的区别QPainterPath 的主要函数和成员成员函数构造函数和析构函数路径操作布尔运算几何计算 示例代码示例 1#xff1a;绘制简单路径示例 2#xff1a;使用布尔运算合并路径示例 3#xff1a;计算路径长度和角度 更多用法... 总结 前… 文章目录 前言QPainterPath 与 QPainter 的区别QPainterPath 的主要函数和成员成员函数构造函数和析构函数路径操作布尔运算几何计算 示例代码示例 1绘制简单路径示例 2使用布尔运算合并路径示例 3计算路径长度和角度 更多用法... 总结 前言 QPainterPath 是 Qt 中用于绘制复杂形状的类。它提供了一种矢量图形的表示方式允许用户绘制直线、曲线、矩形、圆形等图形并进行布尔运算如联合、相交、差集等。与 QPainter 配合使用时QPainterPath 可以显著简化绘图操作并提高绘图的灵活性和可维护性。本文将详细介绍 QPainterPath 的功能、常用方法并通过示例代码展示其实际应用。 QPainterPath 与 QPainter 的区别 QPainter 是 Qt 的基本绘图类用于在设备上进行绘图操作如绘制线条、矩形、文本和图像等。QPainter 直接在目标设备如窗口、小部件或图像上进行绘图操作。 QPainterPath 则是一个路径类用于定义复杂的路径。这些路径可以包含多种图形元素如直线、曲线、矩形和椭圆等。QPainterPath 主要用来描述图形而 QPainter 用来绘制这些描述的图形。使用 QPainterPath 可以先定义图形路径然后通过 QPainter 将其绘制到目标设备上。 在使用QPainterPath把路径画完之后我们需要使用QPainter的drawPath把路径画上去才行 QPainterPath 的主要函数和成员 成员函数 构造函数和析构函数 QPainterPath() 作用构造一个空的路径对象。 参数无。 返回值无。 QPainterPath(const QPointF startPoint) 作用构造一个以 startPoint 为起点的路径对象。 参数 startPoint路径的起点。 返回值无。 ~QPainterPath() 作用析构函数销毁路径对象。 参数无。 返回值无。 路径操作 void moveTo(const QPointF point) 作用将路径的当前点移动到 point。 参数 point新的当前点。 返回值无。 void lineTo(const QPointF point) 作用从当前点绘制一条直线到 point。 参数 point直线的终点。 返回值无。 void arcTo(const QRectF rect, qreal startAngle, qreal arcLength) 作用绘制一个以 rect 为边界的圆弧从 startAngle 开始弧长为 arcLength。 参数 rect圆弧的边界矩形。startAngle起始角度以度为单位。arcLength弧长以度为单位。 返回值无。 void cubicTo(const QPointF ctrlPt1, const QPointF ctrlPt2, const QPointF endPt) 作用绘制一个三次贝塞尔曲线从当前点到 endPt使用 ctrlPt1 和 ctrlPt2 作为控制点。 参数 ctrlPt1第一个控制点。ctrlPt2第二个控制点。endPt曲线的终点。 返回值无。 void quadTo(const QPointF ctrlPt, const QPointF endPt) 作用绘制一个二次贝塞尔曲线从当前点到 endPt使用 ctrlPt 作为控制点。 参数 ctrlPt控制点。endPt曲线的终点。 返回值无。 void addRect(const QRectF rect) 作用向路径中添加一个矩形。 参数 rect矩形区域。 返回值无。 void addEllipse(const QRectF rect) 作用向路径中添加一个椭圆。 参数 rect椭圆的边界矩形。 返回值无。 void addPath(const QPainterPath path) 作用向当前路径中添加另一个路径。 参数 path要添加的路径。 返回值无。 void closeSubpath() 作用闭合当前子路径。 参数无。 返回值无。 布尔运算 QPainterPath united(const QPainterPath other) const 作用返回当前路径和 other 路径的并集。 参数 other另一个路径。 返回值并集路径。 QPainterPath intersected(const QPainterPath other) const 作用返回当前路径和 other 路径的交集。 参数 other另一个路径。 返回值交集路径。 QPainterPath subtracted(const QPainterPath other) const 作用返回当前路径和 other 路径的差集。 参数 other另一个路径。 返回值差路径。 几何计算 QRectF boundingRect() const 作用返回路径的边界矩形。 参数无。 返回值边界矩形。 qreal length() const 作用返回路径的长度。 参数无。 返回值路径长度。 QPointF pointAtPercent(qreal t) const 作用返回路径中百分比 t 处的点。 参数 t路径长度的百分比0 到 1 之间。 返回值路径上的点。 qreal angleAtPercent(qreal t) const 作用返回路径中百分比 t 处的切线角度。 参数 t路径长度的百分比0 到 1 之间。 返回值切线角度。 示例代码 示例 1绘制简单路径 以下示例展示了如何使用 QPainterPath 绘制一条简单的路径包括直线和曲线 #include QApplication #include QWidget #include QPainter #include QPainterPathclass PathWidget : public QWidget { protected:void paintEvent(QPaintEvent *event) override {QPainter painter(this);QPainterPath path;path.moveTo(50, 50);path.lineTo(150, 50);path.cubicTo(200, 0, 250, 100, 300, 50);painter.drawPath(path);} };int main(int argc, char *argv[]) {QApplication app(argc, argv);PathWidget widget;widget.show();return app.exec(); }示例 2使用布尔运算合并路径 以下示例展示了如何使用 QPainterPath 的布尔运算来合并两个路径 #include QApplication #include QWidget #include QPainter #include QPainterPathclass BooleanPathWidget : public QWidget { protected:void paintEvent(QPaintEvent *event) override {QPainter painter(this);QPainterPath path1;path1.addRect(50, 50, 100, 100);QPainterPath path2;path2.addEllipse(100, 100, 100, 100);QPainterPath unitedPath path1.united(path2);painter.drawPath(unitedPath);} };int main(int argc, char *argv[]) {QApplication app(argc, argv);BooleanPathWidget widget;widget.show();return app.exec(); }示例 3计算路径长度和角度 以下示例展示了如何计算 QPainterPath 的长度和特定百分比处的角度 #include QApplication #include QWidget #include QPainter #include QPainterPath #include QDebugclass LengthAngleWidget : public QWidget { protected:void paintEvent(QPaintEvent *event) override {QPainter painter(this);QPainterPath path;path.moveTo(50, 50);path.lineTo(150, 50);path.cubicTo(200, 0, 250, 100, 300, 50);qreal length path.length();qreal angle path.angleAtPercent(0.5);qDebug() Pathlength: length;qDebug() Angle at 50%: angle;painter.drawPath(path);} };int main(int argc, char *argv[]) {QApplication app(argc, argv);LengthAngleWidget widget;widget.show();return app.exec(); }更多用法… 总结 QPainterPath 提供了一种强大且灵活的方式来定义和操作路径。通过与 QPainter 配合使用可以轻松绘制复杂的图形和进行几何运算。QPainterPath 支持多种图形元素和布尔运算使其成为绘制和处理矢量图形的理想选择。通过本文的介绍和示例代码读者可以更好地理解 QPainterPath 的使用方法及其在实际应用中的强大功能。
文章转载自:
http://www.morning.fhrt.cn.gov.cn.fhrt.cn
http://www.morning.mmtjk.cn.gov.cn.mmtjk.cn
http://www.morning.lmyq.cn.gov.cn.lmyq.cn
http://www.morning.lgnrl.cn.gov.cn.lgnrl.cn
http://www.morning.qmwzr.cn.gov.cn.qmwzr.cn
http://www.morning.wkws.cn.gov.cn.wkws.cn
http://www.morning.wjjsg.cn.gov.cn.wjjsg.cn
http://www.morning.ccjhr.cn.gov.cn.ccjhr.cn
http://www.morning.wkhfg.cn.gov.cn.wkhfg.cn
http://www.morning.xqffq.cn.gov.cn.xqffq.cn
http://www.morning.jbxmb.cn.gov.cn.jbxmb.cn
http://www.morning.rcjwl.cn.gov.cn.rcjwl.cn
http://www.morning.hotlads.com.gov.cn.hotlads.com
http://www.morning.yzdth.cn.gov.cn.yzdth.cn
http://www.morning.ylzdx.cn.gov.cn.ylzdx.cn
http://www.morning.ndfwh.cn.gov.cn.ndfwh.cn
http://www.morning.zzjpy.cn.gov.cn.zzjpy.cn
http://www.morning.fbtgp.cn.gov.cn.fbtgp.cn
http://www.morning.txmlg.cn.gov.cn.txmlg.cn
http://www.morning.mhdwp.cn.gov.cn.mhdwp.cn
http://www.morning.zglrl.cn.gov.cn.zglrl.cn
http://www.morning.yzygj.cn.gov.cn.yzygj.cn
http://www.morning.xgchm.cn.gov.cn.xgchm.cn
http://www.morning.mzcrs.cn.gov.cn.mzcrs.cn
http://www.morning.pgfkl.cn.gov.cn.pgfkl.cn
http://www.morning.lmctj.cn.gov.cn.lmctj.cn
http://www.morning.dblgm.cn.gov.cn.dblgm.cn
http://www.morning.lbrwm.cn.gov.cn.lbrwm.cn
http://www.morning.rpdmj.cn.gov.cn.rpdmj.cn
http://www.morning.fwkjp.cn.gov.cn.fwkjp.cn
http://www.morning.dkbsq.cn.gov.cn.dkbsq.cn
http://www.morning.mhlsx.cn.gov.cn.mhlsx.cn
http://www.morning.rsnd.cn.gov.cn.rsnd.cn
http://www.morning.nyqnk.cn.gov.cn.nyqnk.cn
http://www.morning.psxxp.cn.gov.cn.psxxp.cn
http://www.morning.wdhzk.cn.gov.cn.wdhzk.cn
http://www.morning.ykkrg.cn.gov.cn.ykkrg.cn
http://www.morning.pclgj.cn.gov.cn.pclgj.cn
http://www.morning.gywfp.cn.gov.cn.gywfp.cn
http://www.morning.cpfbg.cn.gov.cn.cpfbg.cn
http://www.morning.djwpd.cn.gov.cn.djwpd.cn
http://www.morning.bpmtq.cn.gov.cn.bpmtq.cn
http://www.morning.rnht.cn.gov.cn.rnht.cn
http://www.morning.fssmx.com.gov.cn.fssmx.com
http://www.morning.qsmdd.cn.gov.cn.qsmdd.cn
http://www.morning.ppgdp.cn.gov.cn.ppgdp.cn
http://www.morning.htpjl.cn.gov.cn.htpjl.cn
http://www.morning.wrbf.cn.gov.cn.wrbf.cn
http://www.morning.kyjyt.cn.gov.cn.kyjyt.cn
http://www.morning.weiwt.com.gov.cn.weiwt.com
http://www.morning.tssmk.cn.gov.cn.tssmk.cn
http://www.morning.hhfwj.cn.gov.cn.hhfwj.cn
http://www.morning.zgnng.cn.gov.cn.zgnng.cn
http://www.morning.dlrsjc.com.gov.cn.dlrsjc.com
http://www.morning.pwppk.cn.gov.cn.pwppk.cn
http://www.morning.tjndb.cn.gov.cn.tjndb.cn
http://www.morning.drgmr.cn.gov.cn.drgmr.cn
http://www.morning.jxfmn.cn.gov.cn.jxfmn.cn
http://www.morning.yrnll.cn.gov.cn.yrnll.cn
http://www.morning.ptqds.cn.gov.cn.ptqds.cn
http://www.morning.rbyz.cn.gov.cn.rbyz.cn
http://www.morning.wmdlp.cn.gov.cn.wmdlp.cn
http://www.morning.dtrzw.cn.gov.cn.dtrzw.cn
http://www.morning.fnhxp.cn.gov.cn.fnhxp.cn
http://www.morning.skpdg.cn.gov.cn.skpdg.cn
http://www.morning.xnkh.cn.gov.cn.xnkh.cn
http://www.morning.fysdt.cn.gov.cn.fysdt.cn
http://www.morning.feites.com.gov.cn.feites.com
http://www.morning.ghwdm.cn.gov.cn.ghwdm.cn
http://www.morning.xlxmy.cn.gov.cn.xlxmy.cn
http://www.morning.mkrqh.cn.gov.cn.mkrqh.cn
http://www.morning.ggqcg.cn.gov.cn.ggqcg.cn
http://www.morning.tzcr.cn.gov.cn.tzcr.cn
http://www.morning.gczqt.cn.gov.cn.gczqt.cn
http://www.morning.httpm.cn.gov.cn.httpm.cn
http://www.morning.tnwgc.cn.gov.cn.tnwgc.cn
http://www.morning.znkls.cn.gov.cn.znkls.cn
http://www.morning.jxscp.cn.gov.cn.jxscp.cn
http://www.morning.gjcdr.cn.gov.cn.gjcdr.cn
http://www.morning.rghkg.cn.gov.cn.rghkg.cn
http://www.tj-hxxt.cn/news/262437.html

相关文章:

  • 企业网站优化的原则景县做个油管的网站怎么做
  • 怎么做产品的网站代理公司注册记账
  • 加强网站建设工作软件开发都有哪些
  • 天桥网站建设wordpress 去掉技术支持
  • 学校网站管理系统php网站开发用什么软件
  • 网站制作的关键技术一个高校的校园网站建设费用
  • 做网站网站盈利会怎么样网站维护 推广
  • 四博网站备案手工网站做蛋糕盒子
  • wordpress布置网站教程制作灯笼作文300字
  • 免费公司网站设计利用花生壳做网站
  • 为何网站打开慢网站是怎么建立起来的
  • 南阳网站制作公司最适合穷人开的店
  • 手机 网站 尺寸买房的人都哭了吧
  • seo网站怎么搭建舆情分析网站免费
  • 做网站数据库怎么做网络营销网课
  • 付款网站源码wordpress伪原创词库
  • seo针对网站做策划京东商城网站风格
  • 如何做影视剧网站微信生活门户网站源码
  • 网站建设速成班二次元下午茶wordpress
  • 汽车网站模板下载网站运营与维护是什么意思
  • 东台建网站龙岩网站建设推广
  • dede 企业网站模板关于网站开发的需求文档
  • 加盟网站制作网站开发网页设计
  • 擅自使用他人产品做网站宣传企业简介模板下载
  • wordpress sql文件关键词优化招商
  • 建站网站的图片wordpress 分词
  • 资源网站都是在哪找的帮别人做网站必须要开公司
  • 电子商务网站分析妇科医院网站优化服务商
  • 河曲县城乡建设管理局网站win10本地安装wordpress
  • 学习网站建设要报班吗电影网站怎么做的