Qt example---40000 Chips

结合这个demo来学习图形视图框架,肯定效果很好

    QApplication app(argc, argv);
    app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);

Qt::AA_DontCreateNativeWidgetSiblings
4
Ensures that siblings of native widgets stay non-native unless specifically set by the Qt::WA_NativeWindow attribute.
Native:原生的

Sibling:兄弟

    QSplitter *vSplitter = new QSplitter;
    vSplitter->setOrientation(Qt::Vertical);

 orientation : Qt::Orientation

orientation:方向

splitter:分裂器

side by side:并排的

This property holds the orientation of the splitter

By default, the orientation is horizontal (i.e., the widgets are laid out side by side). The possible orientations are Qt::Horizontal and Qt::Vertical.

Access functions:

Qt::Orientation

orientation() const

void

setOrientation(Qt::Orientation)

            QColor color(image.pixel(int(image.width() * x), int(image.height() * y)));

QRgb QImage::pixel(const QPoint &position) const

pixel:像素

massive:大规模的

manipulation:使用

Returns the color of the pixel at the given position.

If the position is not valid, the results are undefined.

Warning: This function is expensive when used for massive pixel manipulations. Use constBits() or constScanLine() when many pixels needs to be read.

See also setPixel(), valid(), constBits(), constScanLine(), and Pixel Manipulation.

    graphicsView->setRenderHint(QPainter::Antialiasing, false);

QPainter::Antialiasing
0x01
Indicates that the engine should antialias edges of primitives if possible.
 Antialiasing:抗锯齿

antialias:抗锯齿

primitives:图元

edges:边缘

graphicsView->setDragMode(QGraphicsView::RubberBandDrag);

QGraphicsView::RubberBandDrag
2
A rubber band will appear. Dragging the mouse will set the rubber band geometry, and all items covered by the rubber band are selected. This mode is disabled for non-interactive views.

rubber:橡胶

band:带状物

geometry:几何图形

    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);

 optimizationFlags : OptimizationFlags

 optimization:最优化

tune:调整

performance:执行

flags that can be used to tune QGraphicsView's performance.

extra:额外的

bounding:边界框

certain:确定的

aid:帮助

render:绘制

common case:常见情况

degrade:降低

varies:改变

QGraphicsView uses clipping, extra bounding rect adjustments, and certain other aids to improve rendering quality and performance for the common case graphics scene. However, depending on the target platform, the scene, and the viewport in use, some of these operations can degrade performance.

The effect varies from flag to flag; see the OptimizationFlags documentation for details.

By default, no optimization flags are enabled.

This property was introduced in Qt 4.3.

Access functions:

OptimizationFlags

optimizationFlags() const

void

setOptimizationFlags(OptimizationFlags flags)

See also setOptimizationFlag().

enum QGraphicsView::OptimizationFlag
flags QGraphicsView::OptimizationFlags

This enum describes flags that you can enable to improve rendering performance in QGraphicsView. By default, none of these flags are set. Note that setting a flag usually imposes a side effect, and this effect can vary between paint devices and platforms.

imposes:强制推行

a side effect:副作用


QGraphicsView::DontSavePainterState
0x2
When rendering, QGraphicsView protects the painter state (see QPainter::save()) when rendering the background or foreground, and when rendering each item. This allows you to leave the painter in an altered state (i.e., you can call QPainter::setPen() or QPainter::setBrush() without restoring the state after painting). However, if the items consistently do restore the state, you should enable this flag to prevent QGraphicsView from doing the same.
altered:改变

graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);

 enum QGraphicsView::ViewportUpdateMode

This enum describes how QGraphicsView updates its viewport when the scene contents change or are exposed.

expose:显露


QGraphicsView::SmartViewportUpdate
2
QGraphicsView will attempt to find an optimal update mode by analyzing the areas that require a redraw.

attempt:尝试

optimal:最佳的

    zoomInIcon->setAutoRepeat(true);

 autoRepeat : bool

regular:规律的

intervals:间隔

initial:最初的

This property holds whether autoRepeat is enabled

If autoRepeat is enabled, then the pressed(), released(), and clicked() signals are emitted at regular intervals when the button is down. autoRepeat is off by default. The initial delay and the repetition interval are defined in milliseconds by autoRepeatDelay and autoRepeatInterval.

Note: If a button is pressed down by a shortcut key, then auto-repeat is enabled and timed by the system and not by this class. The pressed(), released(), and clicked() signals will be emitted like in the normal case.

Access functions:

bool

autoRepeat() const

void

setAutoRepeat(bool)

autoRepeatDelay : int

kicks in:开始运作

This property holds the initial delay of auto-repetition

If autoRepeat is enabled, then autoRepeatDelay defines the initial delay in milliseconds before auto-repetition kicks in.

This property was introduced in Qt 4.2.

void QAbstractScrollArea::setViewport(QWidget *widget)

viewport:视口,视窗

Sets the viewport to be the given widget. The QAbstractScrollArea will take ownership of the given widget.

If widget is 0, QAbstractScrollArea will assign a new QWidget instance for the viewport.

This function was introduced in Qt 4.2.

[pure virtual] QRectF QGraphicsItem::boundingRect() const

This pure virtual function defines the outer bounds of the item as a rectangle; all painting must be restricted to inside an item's bounding rect. QGraphicsView uses this to determine whether the item requires redrawing.

arbitrary:随心所欲的

Although the item's shape can be arbitrary, the bounding rect is always rectangular, and it is unaffected by the items' transformation.

notifies:通知

imminent:即将发生的

artifacts:史前古器物

Reimplement:重定义

If you want to change the item's bounding rectangle, you must first call prepareGeometryChange(). This notifies the scene of the imminent change, so that it can update its item geometry index; otherwise, the scene will be unaware of the item's new geometry, and the results are undefined (typically, rendering artifacts are left within the view).

Reimplement this function to let QGraphicsView determine what parts of the widget, if any, need to be redrawn.

compensate:补偿

though:不过

Note: For shapes that paint an outline / stroke, it is important to include half the pen width in the bounding rect. It is not necessary to compensate for antialiasing, though.

Example:

  QRectF CircleItem::boundingRect() const
  {
      qreal penWidth = 1;
      return QRectF(-radius - penWidth / 2, -radius - penWidth / 2,
                    diameter + penWidth, diameter + penWidth);
  }

[virtual] QPainterPath QGraphicsItem::shape() const

Returns the shape of this item as a QPainterPath in local coordinates. The shape is used for many things, including collision detection, hit tests, and for the QGraphicsScene::items() functions.

collision detection:碰撞检测

accurate:精确的

round:圆形的

The default implementation calls boundingRect() to return a simple rectangular shape, but subclasses can reimplement this function to return a more accurate shape for non-rectangular items. For example, a round item may choose to return an elliptic shape for better collision detection. For example:

  QPainterPath RoundItem::shape() const
  {
      QPainterPath path;
      path.addEllipse(boundingRect());
      return path;
  }

The outline of a shape can vary depending on the width and style of the pen used when drawing. If you want to include this outline in the item's shape, you can create a shape from the stroke using QPainterPathStroker.

This function is called by the default implementations of contains() and collidesWithPath().

collides:碰撞

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/905364.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Oracle视频基础1.3.2练习

1.3.2 看 Oracle 实例是否启动 ps -ef | grep oracle备份已有的数据库文件到 old 文件夹,用 sample pfile 手动创建新的数据库文件 pfile mkdir old,mv * old,ls,cd old,cp init.ora …/initwilson.ora编辑 pfile,修改 db_name,db_block_siz…

“中信同业+”焕新升级 锚定数字金融新主线,做实金融“五篇大文章”

9月20日,“中信同业”升级发布会及生物多样性债券指数发布在京顺利举办,此次活动以“做强数字金融 服务实体经济”为主题,由中信金控指导,中信银行主办,中信各金融子公司联合承办。来自银行、证券、保险、基金等行业百…

重学SpringBoot3-Spring WebFlux之HttpHandler和HttpServer

更多SpringBoot3内容请关注我的专栏:《SpringBoot3》 期待您的点赞👍收藏⭐评论✍ 重学SpringBoot3-Spring WebFlux之HttpHandler和HttpServer 1. 什么是响应式编程?2. Project Reactor 概述3. HttpHandler概述3.1 HttpHandler是什么3.2 Http…

全桥PFC电路及MATLAB仿真

一、PFC电路原理概述 PFC全称“Power Factor Correction”(功率因数校正),PFC电路即能对功率因数进行校正,或者说是能提高功率因数的电路。是开关电源中很常见的电路。功率因数是用来描述电力系统中有功功率(实际使用…

【音视频 | ADPCM】音频编码ADPCM详细介绍及例子

😁博客主页😁:🚀https://blog.csdn.net/wkd_007🚀 🤑博客内容🤑:🍭嵌入式开发、Linux、C语言、C、数据结构、音视频🍭 🤣本文内容🤣&a…

python读取视频并转换成gif图片

1. 安装三方库 moviepy 将视频转换成gif,需要使用 moviepy库 确保已经安装了moviepy库 pip install moviepy2. 代码实现: from moviepy.editor import VideoFileClipmyclip VideoFileClip("video.mp4") myclip2 myclip.subclip(0, 10).re…

人工智能原理实验二:搜索方法

一、实验目的 本实验课程是计算机、智能、物联网等专业学生的一门专业课程,通过实验,帮助学生更好地掌握人工智能相关概念、技术、原理、应用等;通过实验提高学生编写实验报告、总结实验结果的能力;使学生对智能程序、智能算法等…

在Centos7.9服务器上使用LVM方式挂载磁盘以及Windows磁盘性能测试与Linux磁盘性能测试命令hdparm详细

一、在Centos7.9服务器上使用LVM方式挂载磁盘 在磁盘分区挂载之前,先使用lsblk命令查看磁盘信息,未分区挂载的磁盘sdb只有disk类型没有part类型。40G的硬盘sda已经分了两个区sda1、sda2。而sdb磁盘下并没有分区信息,说明还没有分区。磁盘分区…

dicom基础:乳腺影像方位信息介绍

目录 一、轴位 (CC, Craniocaudal) 二、侧位 (Lateral) 三、侧斜位 (MLO, Mediolateral Oblique) 四、不同的拍摄方位的乳腺影像展示 1、RCC(Right Craniocaudal) 2、LCC(Left Craniocaudal) 3、RMLO(Right Medio…

uniapp 报错Invalid Host header

前言 在本地使用 nginx 反向代理 uniapp 时,出现错误 Invalid Host header 错误原因 因项目对 hostname 进行检查,发现 hostname 不是预期的,所以,报错 Invalid Host header 。 解决办法 这样做是处于安全考虑。但&#xff0…

10个领先的增强现实平台【AR】

增强现实 (AR) 被描述为一种通过计算机生成的内容增强现实世界的交互式体验。 使用软件、应用程序和硬件(例如 AR 眼镜),AR 能够将数字内容叠加到现实环境和物体上。早在 2024 年,许多像 Apple 这样的公司就已进入 VR/AR 市场&am…

匹配——rabin_karp是怎么滚动的?

滚动散列函数 接前面用例公式滚动last_pos第三行第二行第一行证明后话接前面 匹配——散列法里面只说前一个字符乘以128再对72057594037927931求模,答案乘以128加后一个字符再对72057594037927931求模。对应代码: hash_s = (DOMAIN * hash_s + ord(s[i])) % PRIME用例 还是…

国产数据库之Vastbase海量数据库 G100

海量数据库Vastbase是基于openGauss内核开发的企业级关系型数据库。其语法和Oracle数据库很像,基本是从Oracle数据库迁移到海量数据库,以下简单介绍入门的使用 1、建库操作 地址:x.x.x.x root/Qa2021 安装路径:/home/vastbase 创…

进程、孤儿进程、僵尸进程、fork、wait简介

进程相关概念 程序和进程 程序:是指编译好的二进制文件,在磁盘上,占用磁盘空间, 是一个静态的概念. 进程:一个启动的程序, 进程占用的是系统资源,如:物理内存,CPU,终端等…

【万兴科技-注册_登录安全分析报告】

前言 由于网站注册入口容易被黑客攻击,存在如下安全问题: 暴力破解密码,造成用户信息泄露短信盗刷的安全问题,影响业务及导致用户投诉带来经济损失,尤其是后付费客户,风险巨大,造成亏损无底洞…

【笔记】数据结构与算法

参考链接:数据结构(全) 参考链接:数据结构与算法学习笔记 一些PPT的整理,思路很不错,主要是理解角度吧,自己干啃书的时候结合一下会比较不错 0.总论 1.数据 注:图是一种数据结构!!…

匿名内部类的理解

这个知识点困惑我很久,前几天面试的时候也问到了,没回答出来 首先先说说使用步骤吧 1.有一个接口,且含有一个抽象方法(通常情况我们不会写abstract关键字,冗余的) 2.然后有一个外部类(Anonymo…

深入探索电能消耗数据:基于机器学习的分析与洞察

✅作者简介:2022年博客新星 第八。热爱国学的Java后端开发者,修心和技术同步精进。 🍎个人主页:Java Fans的博客 🍊个人信条:不迁怒,不贰过。小知识,大智慧。 💞当前专栏…

架构的本质之 MVC 架构

前言 程序员习惯的编程方式就是三步曲。 所以,为了不至于让一个类撑到爆💥,需要把黄色的对象、绿色的方法、红色的接口,都分配到不同的包结构下。这就是你编码人生中所接触到的第一个解耦操作。 分层框架 MVC 是一种非常常见且常…

突破挑战,创新前行 | 生信科技SOLIDWORKS 2025新品发布会·合肥站精彩回顾

2024年10月18日,由生信科技举办的首场SOLIDWORKS 2025新产品发布会在安徽合肥圆满落幕。现场邀请到制造业的专家学者们一同感受SOLIDWORKS 2025最新功能,探索制造业数字化转型之路。 合肥站活动日,由生信科技副总经理徐建开场。他以智造无界&…