void QLayout::setContentsMargins ( int left, int top,
int right, int bottom )

Sets the lefttopright,
and bottom margins to use around the layout.

By default, QLayout uses the values provided by the style.
On most platforms, the margin is 11 pixels in all directions.

This function was introduced in Qt 4.3.

这个说默认有11像素的间隙。

测试不行。

//hlayout->setContentsMargins(0,0,0,0);

//hlayout->setContentsMargins(QMargins(0,0,0,0));

主要通过setMargin(0) 设置Layout 的外部边界为0

    hlayout->addWidget(start);
    hlayout->addWidget(settle);
    hlayout->addWidget(treatement);
    hlayout->addWidget(final);
    //hlayout->setStretchFactor(hlayout,0);
    hlayout->setMargin(0);
    //hlayout->setContentsMargins(0,0,0,0);
    //hlayout->setContentsMargins(QMargins(0,0,0,0));
    hlayout->setSpacing(0);
    //这个设置成功

【Qt开发】布局控件之间的间距设置的更多相关文章

  1. CAD控件:QT开发使用控件入门

    1. 环境搭建: 3 1.1. 安装Qt 3 1.2. 安装Microsoft Windows SDK的调试包 6 2. QT中使用MxDraw控件 7 1.3. 引入控件 7 3. 打开DWG文件 ...

  2. Qt之QSpacerItem(控件之间的间距不尽相同,可以借助QSpacerItem来设置,并且还可以对QSpacerItem设置QSizePolicy)

    http://blog.csdn.net/u011012932/article/details/51614868

  3. PyQt(Python+Qt)学习随笔:布局控件layoutSpacing属性

    在Qt Designer中布局控件有4个,分别是Vertical Layout(垂直布局).Horizontal Layout(水平布局).Grid Layout(网格布局).Form Layout( ...

  4. qt ui界面控件布局设计

    1.布局控件简介: 水平布局,里面的控件将水平展示,布局器里面的控件大小若没有固定,其大小将随着布局的大小而自动拉伸.可以通过设置其左(layoutLeftMargin).上(layoutTopMar ...

  5. WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使用

    WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使用 转自:http://www.cnblogs.com/wuhuacong/arch ...

  6. WPF布局控件与子控件的HorizontalAlignment/VerticalAlignment属性之间的关系

    WPF布局控件与子控件的HorizontalAlignment/VerticalAlignment属性之间的关系: 1.Canvas/WrapPanel控件: 其子控件的HorizontalAlign ...

  7. PyQt(Python+Qt)学习随笔:布局控件layout的layoutSizeConstraint属性不起作用的问题解决办法

    在<PyQt(Python+Qt)学习随笔:布局控件layout的layoutSizeConstraint属性>中介绍layout的layoutSizeConstraint属性后,反复测试 ...

  8. PyQt(Python+Qt)学习随笔:布局控件layout的layoutSizeConstraint属性

    在Qt Designer中布局控件有4个,分别是Vertical Layout(垂直布局).Horizontal Layout(水平布局).Grid Layout(网格布局).Form Layout( ...

  9. PyQt(Python+Qt)学习随笔:布局控件layout的LeftMargin等contentsMargins属性

    在Qt Designer中布局控件有4个,分别是Vertical Layout(垂直布局).Horizontal Layout(水平布局).Grid Layout(网格布局).Form Layout( ...

随机推荐

  1. 前端杂谈: Attribute VS Property

    前端杂谈: Attribute VS Property 第一个问题: 什么是 attribute & 什么是 property ? attribute 是我们在 html 代码中经常看到的键值 ...

  2. Django 文件配置、pycharm及django连接数据库、表的增删改查 总结

    静态文件配置 1.你在浏览器中输入网址能够有响应的资源返回给你 是因为后端已经提前给你开设该资源的接口,也就意味着你所能 访问到的资源 都是人家事先定义好的 2.django如何给用户开设资源接口呢? ...

  3. qt5--自定义控件封装

    视频教程地址:https://www.bilibili.com/video/av51766541/?p=30

  4. iview响应式布局

    我想说,我要被逼成前端了. 之前没接触过响应式,这两天和另一位前端程序媛小小的研究了下.做了一个小例子,记录一下,方便以后使用. <template> <div> <Ro ...

  5. eclipse切换工作空间

  6. 信息提示框:MessageBox

    一 函数原型及参数 function MessageBox(hWnd: HWND; Text, Caption: PChar; Type: Word): Integer;   1.参数列表    hW ...

  7. bytes和bytearray总结

    The core built-in types for manipulating binary data are bytes and bytearray. They are supported by ...

  8. G. Gangsters in Central City

    给出一棵$1$为根节点的含$n$个节点的树,叶子节点都是房屋,在一个集合里面添加房屋和移除房屋. 每一次添加和移除后,回答下面两个问题. 1.  使得已选房屋都不能从根节点到达,最少需要砍多少条边. ...

  9. Python GUI教程(六):使用Qt设计师进行窗口布局

    本篇介绍使用qt设计师进行GUI窗口的布局管理,主要包含以下内容: 使用Qt设计师布局我们的窗口部件: 垂直布局: 水平布局: 网格布局: 使用间隔: 使用“伙伴”将label标签与窗口部件进行连接. ...

  10. CodeForces 349B--Color the Fence(贪心)

    B. Color the Fence time limit per test 2 seconds memory limit per test 256 megabytes input standard ...