是否有可能获得由GridLayout填充的大小
Is it possible to get the size filled by a GridLayout?
在QtCreator中,我使用一个表单来绘制网格布局。在我的主窗口类中,我向这个网格布局添加了一个QGraphicsScene
包装器对象,并使用包装器类通过鼠标点击在场景上绘制点。
我点击的是相对于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));
}
我不确定我完全理解你的目的,但你能不这样做吗?
QRect size = ui->gridLayout->geometry();
相关文章:
- 在c++中用vector填充一个简单的动态数组
- 如何使用用户输入在C++中正确填充2D数组
- 如何找到大小'x'数组是否完全填充,在C++?
- Cuda C++:设备上的Malloc类,并用来自主机的数据填充它
- 通过for循环使用用户输入填充列表
- 根据用户输入用字母填充矢量,并将"开始"和"结束"放在四肢
- 如何正确填充在堆上分配的二维数组?
- 将数字转换为填充字符串
- 有没有办法在一行中填充矢量图
- 用C++中的数字和条件填充向量
- 用真值填充矢量
- 使用结构成员指针在C++中填充结构
- 流填充字符的默认定位
- 使用不同算法的 PKCS1v15 填充进行加密 ++ 签名
- C++:使用缓冲区中的数据填充结构
- 如何将零填充的多维数组传递给 C++ 中的函数?
- Cryptopp:获取密码输入的填充字符串
- 填充上编译器生成的复制构造函数之间的不一致
- RcppEigen 模板化函数,用于填充单位法线
- 是否有可能获得由GridLayout填充的大小