首页 > 其他分享 >QT——代码添加弹簧,QSpacerItem

QT——代码添加弹簧,QSpacerItem

时间:2022-10-08 20:36:15浏览次数:61  
标签:pHLayout 20 QT 弹簧 添加 addWidget new QSpacerItem

QHBoxLayout *pHLayout = new QHBoxLayout();
pHLayout->addWidget(pButton1);
// 添加空白区宽20px、高20px
pHLayout->addSpacerItem(new QSpacerItem(20, 20));
pHLayout->addWidget(pButton2);
// 添加间距10px
pHLayout->addSpacing(10);
pHLayout->addWidget(pButton3);
// 添加空白区宽20px、高20px,宽度尽可能的缩小、放大
pHLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
pHLayout->addWidget(pButton4);
pHLayout->addSpacing(2);
pHLayout->addWidget(pButton5);

pHLayout->setSpacing(0);
pHLayout->setMargin(0);
setLayout(pHLayout);

标签:pHLayout,20,QT,弹簧,添加,addWidget,new,QSpacerItem
From: https://www.cnblogs.com/RedWetPlace/p/16770111.html

相关文章