尝试向 QGraphicsView 添加文本:
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
QGraphicsScene scene;
scene.addText("Hello, world!");
ui->graphicsView->setScene(&scene);
}
但是当项目运行时,QGraphicsView 上什么都没有。