博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2d graphics
阅读量:5927 次
发布时间:2019-06-19

本文共 1195 字,大约阅读时间需要 3 分钟。

QPainter can draw

geometric shapes (points, lines, rectangles, ellipses, arcs, chords, pie segments,
polygons, and Bézier curves), as well as pixmaps, images, and text. Furthermore,
QPainter supports advanced features such as antialiasing (for text and
shape edges), alpha blending, gradient filling, and vector paths. QPainter also
supports linear transformations, such as translation, rotation, shearing, and
scaling.

By reimplementing QWidget::paintEvent(), we can create custom widgets andexercise complete control over their appearance, as we saw in Chapter 5.

Forcustomizing the look and feel of predefined Qt widgets, we can also specify astyle sheet or create a QStyle subclass; we cover both of these approaches in

使用QPainter 画graphics 必须给他一个a paint device (typically a widget),

void MyWidget::paintEvent(QPaintEvent *event)

{
QPainter painter(this); //THIS IS  A widget
...
}

QPainter painter(this);

painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, 12, Qt::DashDotLine, Qt::RoundCap));
painter.setBrush(QBrush(Qt::green, Qt::SolidPattern));
painter.drawEllipse(80, 80, 400, 240);

转载于:https://www.cnblogs.com/gisbeginner/archive/2012/12/04/2800936.html

你可能感兴趣的文章
Linux系统启动流程详解
查看>>
通过源码解析 Node.js 中一个 HTTP 请求到响应的历程
查看>>
CodeIgniter的密码处理论
查看>>
Spring Cloud Config服务器
查看>>
测试人员必学的软件快速测试方法(二)
查看>>
Agora iOS SDK-快速入门
查看>>
引入间接隔离变化(三)
查看>>
统一沟通-技巧-4-让国内域名提供商“提供”SRV记录
查看>>
cocos2d-x 3.0事件机制及用户输入
查看>>
比亚迪速锐F3专用夏季座套 夏天坐垫 四季坐套
查看>>
程序员全国不同地区,微信(面试 招聘)群。
查看>>
【干货】界面控件DevExtreme视频教程大汇总!
查看>>
闭包 !if(){}.call()
查看>>
python MySQLdb安装和使用
查看>>
Java小细节
查看>>
poj - 1860 Currency Exchange
查看>>
chgrp命令
查看>>
Java集合框架GS Collections具体解释
查看>>
洛谷 P2486 BZOJ 2243 [SDOI2011]染色
查看>>
linux 笔记本的温度提示
查看>>