gpt4 book ai didi

c++ - qt QGraphicsScene 添加项

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:53:07 24 4
gpt4 key购买 nike

http://qt-project.org/doc/qt-4.8/qgraphicsscene.html#addItem

If the item is already in a different scene, it will first be removed from its old scene, and then added to this scene as a top-level.

我想将项目保留在旧场景中。我该怎么做?

myscene1.addItem(item);
myscene2.addItem(item);// I don't want to remove item from myscene1

最佳答案

您可以复制该项目:

myscene1.addItem(item);
myscene2.addItem(item->clone());

关于c++ - qt QGraphicsScene 添加项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24822535/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com