79792088

Date: 2025-10-16 11:36:13
Score: 0.5
Natty:
Report link

You cannot use findChildren() on a layout. You need to call QLayout::count() and QLayout::itemAt() to access its (child) items.

void enableContainedWidgets(QLayout* layout, bool enable) {
  for (int i = 0; i < layout->count(); i++)
    if (auto w = layout->itemAt(i)->widget())
      w->setEnabled(enable);
};
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Florian