【发布时间】:2010-08-24 00:52:10
【问题描述】:
我已经在 QGraphicsScene 子类中为 mousePressEvent() 实现了信号,但我不知道如何在 UI 中使用该类。我可以将 QGraphicsView 小部件添加到我的 UI,但是我如何访问 场景?
GraphicsScene *scene = new QGraphicsScene(this);
// Add pixmap, etc
ui->graphicsView->setScene(scene);
// Here's where I'm stuck
connect(ui->whereIsTheScene?, SIGNAL(clicked(QPoint)), this, SLOT(someSlot(QPoint));
编辑:这是编译,但鼠标按下事件被忽略。我认为这是一个单独的问题,所以我发布了another question
【问题讨论】:
-
我认为您的意思是
...setScene(scene)而不是 ´...setScene(scn)`?
标签: c++ qt qt4 qt-creator