In QtCreator, I used a form to draw a grid layout. In my main window class, I added a QGraphicsScene wrapper object to this grid layout and am using the wrapper class to draw points onto the scene with mouse clicks.
What’s happening is I’m clicking in locations that are negative relative to the QGraphicsScene wrapper, which is not the effect I’m going for, so I want to make sure I know the coordinates filled up by my QGraphicsScene and grid layout.
How can I get the size filled by the grid layout? I’m currently doing something to this effect…
view = new QGraphicsViewWrapper();
ui->gridLayout->addWidget(view);
QGraphicsViewWrapper::QGraphicsViewWrapper(QWidget *parent) : QGraphicsView(parent)
{
scene = new QGraphicsScene(50, 50, 350, 350);
this->setSceneRect(50, 50, 350, 350);
this->setScene(scene);
this->setGeometry(QRect(20, 50, 400, 400));
}
Not sure I completely understand your aim but could you not do: