Qt代码布局中添加弹簧和删除弹簧
作者:互联网
/*添加弹簧*/
QVBoxLayout* vboxLayout = new QVBoxLayout;
vboxLayout->addStretch();
/*删除弹簧*/
for (int i = 0; i < pLayout->count(); ++i)
{
QLayoutItem *layoutItem = pLayout->itemAt(i);
if (layoutItem->spacerItem())
{
pLayout->removeItem(layoutItem);
--i;
}
}
/*转载出:https://www.jianshu.com/p/daf9c035f883*/
标签:Qt,QVBoxLayout,layoutItem,弹簧,添加,pLayout,vboxLayout 来源: https://blog.csdn.net/qq_45662588/article/details/121940889