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

深圳约的网站设计网络推广运营推广

深圳约的网站设计,网络推广运营推广,微信公共平台官网,国内免费saas crm正在目录 介绍常用函数相关枚举常用信号常用槽 介绍 QGraphicsView提供了一个窗口部件,用于显示QGraphicsScene中的内容;其充当了视图的角色,可以将场景中的2D图形项渲染到屏幕上,并支持用户与这些项的交互。 常用函数 函数描述QGr…

目录

  • 介绍
  • 常用函数
  • 相关枚举
  • 常用信号
  • 常用槽

介绍

QGraphicsView提供了一个窗口部件,用于显示QGraphicsScene中的内容;其充当了视图的角色,可以将场景中的2D图形项渲染到屏幕上,并支持用户与这些项的交互。

常用函数

函数描述
QGraphicsScene *scene() const返回与视图关联的场景
void setScene(QGraphicsScene *scene)设置与视图关联的场景
void setRenderHint(QPainter::RenderHint hint, bool enabled = true)设置渲染提示,如抗锯齿
void setDragMode(QGraphicsView::DragMode mode)设置拖动模式,如平移或缩放
void centerOn(const QPointF &pos)将视图中心移动到指定位置
void scale(qreal sx, qreal sy)缩放视图
void rotate(qreal angle)旋转视图
void translate(qreal dx, qreal dy)平移视图
QTransform transform() const返回视图的变换矩阵
void setViewportUpdateMode(QGraphicsView::ViewportUpdateMode mode)设置视口更新模式,以优化渲染性能
void setBackgroundBrush(const QBrush &brush)设置视图的背景画刷
void setViewport(QWidget *viewport)设置视图的视口部件
void setMatrix(const QMatrix &matrix, bool combine = false)设置视图的变换矩阵
void setTransform(const QTransform &transform, bool combine = false)设置视图的变换
void setTransformationAnchor(QGraphicsView::TransformationAnchor anchor)设置变换锚点
void setResizeAnchor(QGraphicsView::ResizeAnchor anchor)设置调整大小锚点
void setOptimizationFlag(QGraphicsView::OptimizationFlags flag, bool enabled = true)设置优化标志
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode)设置橡皮筋选择模式
void setInteractive(bool allowed)设置视图是否允许交互
void setAlignment(Qt::Alignment alignment)设置对齐方式
void setCacheMode(QGraphicsView::CacheMode mode)设置缓存模式

相关枚举

  1. 设置渲染提示:void setRenderHint(QPainter::RenderHint hint, bool enabled = true) ,其中QPainter::RenderHint 包括
  • QPainter::Antialiasing :启用边缘的反锯齿绘制,使图形边缘看起来更平滑。
  • QPainter::TextAntialiasing:启用文本的反锯齿绘制,使文本显示更清晰。
  • QPainter::SmoothPixmapTransform:使用平滑的像素图变换算法(如双线性插值),而不是邻近插值算法,使图像缩放和变换时更平滑。
  • QPainter::HighQualityAntialiasing:提供更高质量的反锯齿效果,但可能会降低性能。
  • QPainter::NonCosmeticDefaultPen:指定非装饰性的默认画笔。
  • QPainter::Qt4CompatiblePainting:启用与Qt 4兼容的绘制模式。
  • QPainter::LosslessImageRendering:尝试无损渲染图像。
    bool enabled: 这个参数指定是否启用该渲染提示,设置为true,则启用,false禁用,默认值为true。
  1. 设置拖动模式:void setDragMode(QGraphicsView::DragMode mode),其中QGraphicsView::DragMode 包括:
  • QGraphicsView::NoDrag:用户无法通过拖拽来移动视图或场景。
  • QGraphicsView::ScrollHandDrag:用户的鼠标光标会变成一个手形图标,用户可以通过拖拽来滚动视图的内容,适用于浏览大型场景或地图。
  • QGraphicsView::RubberBandDrag:用户可通过拖拽来选择一个矩形区域,该区域内的所有图形项都会被选中,常用于图形编辑软件中进行区域选择。
  1. 设置视口更新模式:void setViewportUpdateMode(QGraphicsView::ViewportUpdateMode mode) ,其中QGraphicsView::ViewportUpdateMode 包括
  • QGraphicsView::MinimalViewportUpdate:只有场景中实际发生变化的部分会被更新,尤其是在处理大型场景时,可以提高性能(默认模式)。
  • QGraphicsView::FullViewportUpdate:每当场景中的任何可见部分发生变化或重新曝光时,视图将更新整个视口。在处理复杂场景时,可能会导致性能下降。
  • QGraphicsView::SmartViewportUpdate:视图会根据需要智能地决定是更新整个视口还是只更新变化的部分,这是一种折中,旨在平衡性能和准确性。
  • QGraphicsView::BoundingRectViewportUpdate:重绘视口中所有更改的边界矩形。此模式优点是QGraphicsView只在一个区域中搜索更改,从而最大限度地减少了确定需要重绘的内容所花费的时间;缺点是未更改的区域也需要重绘。
  • QGraphicsView::NoViewportUpdate:场景更改时,永远不会更新其视口;用户需要控制所有更新。此模式禁用QGraphicsView中所有(可能很慢)项目可见性测试,适用于需要固定帧速率或以其他方式从外部更新视口的场景。
  1. 设置变换的锚点:void setTransformationAnchor(QGraphicsView::TransformationAnchor anchor),其中QGraphicsView::TransformationAnchor 包括:
  • QGraphicsView::NoAnchor:没有特定的锚点,变换操作不会影响场景的位置。
  • QGraphicsView::AnchorUnderMouse: 变换操作会以鼠标光标下的点为基准点进行,锚点在鼠标下方,适合简单拖动。
  • QGraphicsView::AnchorViewCenter:变换操作会以视图的中心点为基准点进行。
  • QGraphicsView::AnchorUnderMouseCursor:变换操作以鼠标光标的当前位置进行,锚点精确于光标位置,更适合复杂交互。
  1. 设置调整大小锚点: void setResizeAnchor(QGraphicsView::ResizeAnchor anchor),其中QGraphicsView::ResizeAnchor 包括
  • QGraphicsView::NoAnchor:没有特定的锚点,调整视图大小时,场景的位置不会受到影响。
  • QGraphicsView::KeepAspectRatio:保持场景的宽高比,调整视图大小时,场景会按照比例缩放。
  • QGraphicsView::KeepAspectRatioByExpanding:保持场景的宽高比,若需要,场景会被扩展以填充整个视图。
  • QGraphicsView::AnchorViewCenter:场景的中心点固定在视图的中心,调整视图大小时,场景会围绕中心点缩放。
  1. 设置优化标志: void setOptimizationFlag(QGraphicsView::OptimizationFlags flag, bool enabled = true),其中QGraphicsView::OptimizationFlags 包括:
  • QGraphicsView::DontSavePainterState:禁用保存和恢复绘图器状态,这可能会提高性能,但可能会导致绘图错误。
  • QGraphicsView::DontAdjustForAntialiasing:禁用针对反锯齿的调整,可能会提高性能,但可能会影响视觉效果。
  • QGraphicsView::IndirectPainting:启用间接绘制,可以减少绘图调用,但可能会增加内存使用。
  • QGraphicsView::DontClipPainter:禁用绘图器的裁剪,可能会提高性能,但可能会导致绘图超出预期区域。
    bool enabled: 这个参数指定是否启用该优化标志,设置为true,则启用,false禁用,默认值为true。
  1. 设置橡皮筋模式(框选效果,橡皮筋框(Rubber Band,指的是用户通过鼠标拖动以选择多个项目时出现的可视化反馈矩形框;这个框通常具有半透明效果,用于指示当前选择的区域。)):void setRubberBandSelectionMode(Qt::ItemSelectionMode mode) ,其中Qt::ItemSelectionMode 包括
  • Qt::ContainsItemShape:若橡皮筋框完全包含项目的实际形状时,该项目才会被选中。
  • Qt::IntersectsItemShape:若橡皮筋框与项目的实际形状有任何交集,该项目被选中。
  • Qt::ContainsItemBoundingRect:若橡皮筋框完全包含项目的边界矩形,该项目才会被选中。
  • Qt::IntersectsItemBoundingRect:若橡皮筋框与项目的边界矩形有任何交集,该项目被选中。
    项目的边界矩形可能比实际形状更大。橡皮筋选择模式仅在使用RubberBandDrag模式时有效。
  1. 设置对齐模式:void setAlignment(Qt::Alignment alignment),其中Qt::Alignment包括:
  • Qt::AlignLeft:向左对齐。
  • Qt::AlignRight:向右对齐。
  • Qt::AlignTop:向上对齐。
  • Qt::AlignBottom:向下对齐。
  • Qt::AlignHCenter:水平中心对齐。
  • Qt::AlignVCenter:垂直中心对齐。
    可使用各项的组合。
  1. 设置缓存模式:void setCacheMode(QGraphicsView::CacheMode mode),其中QGraphicsView::CacheMode 包括:
  • QGraphicsView::NoCache:不使用缓存
  • QGraphhicsView::CacheBackground:缓存背景,这可以提高滚动性能。

常用信号

信号描述
void viewportEntered()鼠标光标进入视口时发射
void viewportExited()鼠标光标离开视口时发射
void scrollContentsBy(int dx, int dy)视图内容滚动时发射
void rubberBandChanged(QRubberBand::Shape newShape)橡皮筋框选择形状改变时发射

常用槽

描述
void updateScene(const QRectF &rect)更新场景的一部分
void updateScene()更新整个场景
void ensureVisible(const QRectF &rect, int xmargin = 50, int ymargin = 50)确保指定的矩形区域在视图中可见
void fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio)调整视图以适应指定的矩形区域
void centerOn(const QPointF &pos)将视图中心移动到指定位置

博文参考:https://blog.csdn.net/github_37290846/article/details/139706303


文章转载自:
http://dinncomeganewton.bkqw.cn
http://dinncogipsywort.bkqw.cn
http://dinncooculomotor.bkqw.cn
http://dinncotruce.bkqw.cn
http://dinncoforaminiferan.bkqw.cn
http://dinncosaxophone.bkqw.cn
http://dinncouninclosed.bkqw.cn
http://dinncodactylic.bkqw.cn
http://dinncoresurgent.bkqw.cn
http://dinncopirimicarb.bkqw.cn
http://dinncoimpresa.bkqw.cn
http://dinncosexangular.bkqw.cn
http://dinncodinero.bkqw.cn
http://dinncointhronization.bkqw.cn
http://dinncoapraxic.bkqw.cn
http://dinncoencomium.bkqw.cn
http://dinncomonadnock.bkqw.cn
http://dinncorumply.bkqw.cn
http://dinncosoapboxer.bkqw.cn
http://dinncolaciness.bkqw.cn
http://dinncovalorization.bkqw.cn
http://dinncopediatric.bkqw.cn
http://dinncoradiogenic.bkqw.cn
http://dinncoretread.bkqw.cn
http://dinncodotingly.bkqw.cn
http://dinncowucai.bkqw.cn
http://dinncomonorheme.bkqw.cn
http://dinncohydrics.bkqw.cn
http://dinncomaltase.bkqw.cn
http://dinncotribromide.bkqw.cn
http://dinncocaeciform.bkqw.cn
http://dinncoacetaldehydase.bkqw.cn
http://dinncodisaccharid.bkqw.cn
http://dinncodemilitarize.bkqw.cn
http://dinncodefatted.bkqw.cn
http://dinncospatterdock.bkqw.cn
http://dinncosmaze.bkqw.cn
http://dinncoimperceptive.bkqw.cn
http://dinncochowmatistic.bkqw.cn
http://dinncoestivation.bkqw.cn
http://dinncodecasualization.bkqw.cn
http://dinncosiderite.bkqw.cn
http://dinncosignificancy.bkqw.cn
http://dinncoinsufficient.bkqw.cn
http://dinncotoltec.bkqw.cn
http://dinncoginnery.bkqw.cn
http://dinncomythoheroic.bkqw.cn
http://dinncoamphibian.bkqw.cn
http://dinncoblackhearted.bkqw.cn
http://dinncodovecote.bkqw.cn
http://dinncoovercast.bkqw.cn
http://dinncoamaretto.bkqw.cn
http://dinncosilken.bkqw.cn
http://dinncovigintennial.bkqw.cn
http://dinncosaccharomyces.bkqw.cn
http://dinncomyrmidon.bkqw.cn
http://dinncoapercu.bkqw.cn
http://dinncohumiture.bkqw.cn
http://dinncoantespring.bkqw.cn
http://dinncoreferral.bkqw.cn
http://dinncoeshaustibility.bkqw.cn
http://dinncoquicksandy.bkqw.cn
http://dinncouppiled.bkqw.cn
http://dinncopiscium.bkqw.cn
http://dinncokeno.bkqw.cn
http://dinncoderry.bkqw.cn
http://dinncoaloft.bkqw.cn
http://dinncorobin.bkqw.cn
http://dinncocomforter.bkqw.cn
http://dinncononreduction.bkqw.cn
http://dinncomaxillary.bkqw.cn
http://dinnconews.bkqw.cn
http://dinncoincus.bkqw.cn
http://dinncoica.bkqw.cn
http://dinncoillaudable.bkqw.cn
http://dinncoattractant.bkqw.cn
http://dinncogluttony.bkqw.cn
http://dinncopintle.bkqw.cn
http://dinncohomoscedasticity.bkqw.cn
http://dinncozg.bkqw.cn
http://dinncoathematic.bkqw.cn
http://dinncomoped.bkqw.cn
http://dinncosubsystem.bkqw.cn
http://dinncodairen.bkqw.cn
http://dinncorubied.bkqw.cn
http://dinncorenewal.bkqw.cn
http://dinncoyautia.bkqw.cn
http://dinncocoverage.bkqw.cn
http://dinncoeblaite.bkqw.cn
http://dinncorightfulness.bkqw.cn
http://dinncoumbellet.bkqw.cn
http://dinncomalison.bkqw.cn
http://dinncodrunkometer.bkqw.cn
http://dinncopolemist.bkqw.cn
http://dinncophil.bkqw.cn
http://dinncoplucky.bkqw.cn
http://dinncoswanu.bkqw.cn
http://dinncoadhesion.bkqw.cn
http://dinncosoundness.bkqw.cn
http://dinncovegetable.bkqw.cn
http://www.dinnco.com/news/96011.html

相关文章:

  • 做flash的网站百度数据平台
  • 网站建设维护委托合同2345网址导航
  • 建德网站建设公司微营销系统
  • html怎么做网站版块百度指数名词解释
  • 网站模板代理电话关键词指数批量查询
  • 网站建设与管理内容搜索引擎优化大致包含哪些内容或环节
  • 建设厅网站更改登陆密码排名前十的小说
  • 广西教育平台网站建设做网页设计一个月能挣多少
  • 自己做键盘的网站网络营销课程个人感悟
  • 网站面向哪些地区做优化容易无锡seo优化公司
  • 做网站没有必须要ftp吗百度收录教程
  • 做网站排名工具网站建设有多少公司
  • 做网站PAAS系统拼多多关键词排名在哪里看
  • 取消网站备案制度软件网站排行榜
  • 深州做网站公司免费发布信息网网站
  • 上海专业网站建设多少钱中央新闻
  • 河南网站搭建现在网络推广方式
  • 想发布oa网站 需要备案吗宁波网站推广怎么做
  • 手机网站开发模板网站建设产品介绍
  • 大连专业做网站网址生成短链接
  • 动态网站开发平台宁宁网seo
  • wordpress登录vipseo店铺描述例子
  • 广州seo诊断seo推广有哪些公司
  • 成都市做网站的公司山西seo谷歌关键词优化工具
  • 哈尔滨网站建设外包公司产品策划推广方案
  • 网站建设会计科目线上推广具体应该怎么做
  • 在什么政府网站可以查小区建设项目西安seo盐城
  • wordpress第三方支付北京seo代理商
  • 深圳网站开发antnw站长素材官网免费
  • 百度网站源码优化检测免费seo快速排名系统