I was wondering if it was possible to use same layout objects (a QHBoxLayout, i.e) to define the layout of different objects.

E.g.


Qt Code:
  1. QHBoxLayout * boxLayout;
  2. QGridLayout * gridLayout;
  3.  
  4. QGroupBox * group1;
  5. QGroupBox * group2;
  6. QGroupBox * group3;
  7.  
  8. QComboBox * comboBox1;
  9. QComboBox * comboBox2;
  10. QComboBox * comboBox3;
  11.  
  12. QLabel * label1;
  13. QLabel * label2;
  14. QLabel * label3;
  15.  
  16. //-------------------
  17.  
  18. gridLayout->addWidget(label1);
  19. gridLayout->addWidget(comboBox1);
  20.  
  21. groupBox->setLayout(gridLayout);
To copy to clipboard, switch view to plain text mode 

and then do somethingl ike gridLayout->clear(); and reuse that layout.

My problem is that I've found myself in need of nested layouts inside 3 GroupBoxes and it would be rather annoying to triple the ammount of objects (once for every GroupBox) just because of it.

Thanks for your help.