首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Qt QGraphicsView translate BackgroundBrush

Qt QGraphicsView translate BackgroundBrush
EN

Stack Overflow用户
提问于 2015-09-28 13:27:47
回答 1查看 141关注 0票数 0

我已经创建了一个从QGraphicsView派生的视图类,并将backgroundBrush设置为图像。我想翻译一下backgroundBrush。我尝试过以下几种方法

代码语言:javascript
复制
// graphicsView derived from QGraphicsView 
graphicsView->backgroundBrush().transform().translate(moveX, moveY);

但它并没有改变背景笔刷。

EN

回答 1

Stack Overflow用户

发布于 2015-09-28 20:33:02

您需要调用setBackgroundBrush()setTransform()来修改这些属性:

代码语言:javascript
复制
QBrush brush = graphicsView->backgroundBrush();
brush.setTransform(QTransform::fromTranslate(moveX, moveY));
graphicsView->setBackgroundBrush(brush);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32816196

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档