我如何调整大小QVBoxLayout填充表单没有空间
How can i resize QVBoxLayout to fill Form without space?
如何调整QVBoxLayout来填充表单没有空间?
与空间:http://0000.2.img98.net/out.php/i25106_with-space.png
没有空间:http://0000.2.img98.net/out.php/i25107_without-space.png
你必须设置布局的外边距
的例子:
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QVBoxLayout* l = new QVBoxLayout();
l->setMargin(0); ///m
QWidget w; w.setFixedSize(300,300);
w.setLayout(l);
l->addWidget(new QPushButton("fd"));
w.show();
return app.exec();
}
您需要调整布局中包含的小部件的大小策略。
例如,如果您希望一个小部件占用布局中所有可用的垂直空间,则将小部件的大小策略设置为Expanding
。
进入项目文件夹,找到Qt Creator下无法编辑的xml文件。您将发现margin xml标记。根据需要增加或减少该值。xml文件不能在Qt Creator下编辑
相关文章:
- 在c++中用vector填充一个简单的动态数组
- 如何使用用户输入在C++中正确填充2D数组
- 如何找到大小'x'数组是否完全填充,在C++?
- Cuda C++:设备上的Malloc类,并用来自主机的数据填充它
- 通过for循环使用用户输入填充列表
- 根据用户输入用字母填充矢量,并将"开始"和"结束"放在四肢
- 如何正确填充在堆上分配的二维数组?
- 将数字转换为填充字符串
- 有没有办法在一行中填充矢量图
- 用C++中的数字和条件填充向量
- 用真值填充矢量
- 使用结构成员指针在C++中填充结构
- 流填充字符的默认定位
- 使用不同算法的 PKCS1v15 填充进行加密 ++ 签名
- C++:使用缓冲区中的数据填充结构
- 如何将零填充的多维数组传递给 C++ 中的函数?
- Cryptopp:获取密码输入的填充字符串
- 填充上编译器生成的复制构造函数之间的不一致
- RcppEigen 模板化函数,用于填充单位法线
- 我如何调整大小QVBoxLayout填充表单没有空间