Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
通过以下代码隐藏一行
field.hide() formLayout.labelForField(field).hide()
上述的一个缺点是,当行中的项目被隐藏时,行上方和下方的间距仍然存在,也就是说,隐藏行上方和下方的行看起来比布局中的其余项目更分散。如何在 QFormLayout 中隐藏一行后删除剩余间距?
隐藏:
field->hide(); label->hide(); formLayout->removeWidget(field); formLayout->removeWidget(label);
节目:
formLayout->insertRow(row, label, field); label->show(); field->show();