如果我想在第一个地方甚至使用QGraphicsView::scene()
,语法会是什么样子?我的目标是用滑块在我的图形视图对象中更改pixmap
的比例。我想用QgraphicsView::scene()
和QScene::itemsAt()
等找到原始pixmap
,然后使用QPixmap::scaled()
(我发现这将是唯一的方法来确保我的化妆品属性设置为pixmap
成立)。但是,我遇到了QGraphicsView::scene()
的语法问题。我的尝试如下。我还创建了一个Qt窗口小部件应用程序。使用QGraphicsView方法场景()来分配QGraphicsScene变量
QGraphicsViewScene graphicsScene = ui->PixmapView->scene();
QGraphicsPixmapItem graphicsPixmapItem = graphicsScene.itemAt(0, 0);
编辑 如果我来存储我的QPixmap像素图*作为成员变量,我不能完全确定如何实现它范围仍然为我的插槽。
编辑 静态成员变量?
这应该是QGraphicsScene * graphicsScene,不是的QGraphicsView –
你为什么不只是存储你的'QGraphicsPixmapItem *'作为成员变量? – thuga
@thuga我会怎么做对不起 – CrippledTable