本文整理汇总了C++中QLayout::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ QLayout::isEmpty方法的具体用法?C++ QLayout::isEmpty怎么用?C++ QLayout::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLayout
的用法示例。
在下文中一共展示了QLayout::isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clearOutConfig
void PinConfig::clearOutConfig()
{
QLayout *groupBoxLayout = this->subConfigGroupBox->layout();
if (!groupBoxLayout)
return;
while (!groupBoxLayout->isEmpty())
{
QWidget *widget = groupBoxLayout->itemAt(0)->widget();
groupBoxLayout->removeWidget(widget);
delete widget;
}
delete groupBoxLayout;
}
示例2: dumpWidgetAndChildren
void LayoutDumper::dumpWidgetAndChildren(QDebug& os, const QWidget* w,
int level)
{
QString padding;
for (int i = 0; i <= level; i++) {
padding += " "; // 4 spaces per level
}
QLayout* layout = w->layout();
QList<QWidget*> dumped_children;
if (layout && !layout->isEmpty()) {
os << padding << "Layout: " << getLayoutInfo(layout);
QBoxLayout* box_layout = dynamic_cast<QBoxLayout*>(layout);
if (box_layout) {
os << ", spacing " << box_layout->spacing();
}
os << ":\n";
int num_items = layout->count();
for (int i = 0; i < num_items; i++) {
QLayoutItem* layout_item = layout->itemAt(i);
QString item_info = getLayoutItemInfo(layout_item);
if (!item_info.isEmpty()) {
os << padding << "- " << item_info << "\n";
}
QWidgetItem* wi = dynamic_cast<QWidgetItem*>(layout_item);
if (wi && wi->widget()) {
dumpWidgetAndChildren(os, wi->widget(), level + 1);
dumped_children.push_back(wi->widget());
}
}
}
// now output any child widgets that weren't dumped as part of the layout
QList<QWidget*> widgets = w->findChildren<QWidget*>(
QString(), Qt::FindDirectChildrenOnly);
QList<QWidget*> undumped_children;
foreach (QWidget* child, widgets) {
if (dumped_children.indexOf(child) == -1) {
undumped_children.push_back(child);
}
}
if (!undumped_children.empty()) {
os << padding << "Non-layout children:\n";
foreach (QWidget* child, undumped_children) {
dumpWidgetAndChildren(os, child, level + 1);
}