【发布时间】:2020-01-20 21:35:47
【问题描述】:
我正在 Qt 5 上开展一个国际象棋项目。我将棋盘创建为QWidget,现在我想添加动画国际象棋人物。这就是为什么我想在图形视图上添加我的棋盘。我查阅了 Qt 文档 和其他几个网站。并编写了以下代码:
QGraphicsProxyWidget* pProxy = scene->addWidget(board);
QGraphicsGridLayout *layout = new QGraphicsGridLayout;
layout->addItem(pProxy,0,0);
QGraphicsWidget *form = new QGraphicsWidget;
form->setLayout(layout);
scene->addItem(form);
我收到错误:
no matching function for call to ‘QGraphicsGridLayout::addItem(QGraphicsProxyWidget*&, int, int)
我找不到解决方法。应该使用一种演员表还是写“板”作为QGraphicsWidget?
【问题讨论】:
标签: c++ qt graphics qgraphicsview