【发布时间】:2021-11-07 07:35:13
【问题描述】:
是否可以将 (0,0) 设置为QGraphicsScene 的左上角?默认情况下,它似乎位于视图的中心:
class GraphicsScene : public QGraphicsScene
{
protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
{
// here you can see that (0,0) is at the center of the view
qDebug() << "movement " << event->scenePos();
}
};
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
GraphicsScene* scene = new GraphicsScene;
QGraphicsView* view = new QGraphicsView(scene);
setCentralWidget(view);
}
【问题讨论】:
标签: qt qgraphicsview coordinate-systems qgraphicsscene