Qt垂直布局和水平布局

1. QHBoxLayout, QVBoxLayout实现

https://blog.csdn.net/qq_19004627/article/details/79751427


  .setMargin(int);  //可以设置左、上、右、下的外边距,设置之后,他们的外边距是相同的。

    


  .setContentsMargins(int left, int top, int right, int bottom);  //与其功能相同,但是可以将左、上、右、下的外边距设置为不同的值。

    


   .setContentsMargins(const QMargins &margins);   // 设置外边距(同上)

   .setSpacing(int);    //间距设置

    


    . addStretch();添加了一个伸缩空间(QSpacerItem)

    


      .setStretchFactor(QWidget *w, int stretch) , setStretchFactor(QLayout *l, int stretch); //设置控件、布局的拉伸系数

    



  

原文地址:https://www.cnblogs.com/mathyk/p/9047617.html