What about foreach ?
Qt Code:
  1. foreach (QWidget *widget, list) {
  2. ...
  3. }
To copy to clipboard, switch view to plain text mode