0
在QtCreator中,我使用了一個表單來繪製網格佈局。在我的主窗口類中,我向該網格佈局添加了一個QGraphicsScene
包裝對象,並使用包裝類通過鼠標單擊將點繪製到場景上。是否可以通過GridLayout獲取大小?
發生了什麼事是我點擊相對QGraphicsScene
包裝,這不是我要的效果是負面的位置,所以我想確保我知道我的QGraphicsScene
和網格填充的座標佈局。
如何獲得由網格佈局填充的大小?目前,我正在做一些這樣的效果......
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));
}