Hi, i was wondering if it is possible to initalize a child widget within the parent?
I tried to add it in the constructor of the parent, but then the child widgets is not shown...

In this case i want to initialize fx1 in the constructor of floorBoard... this to keep clean main.

Qt Code:
  1. #include "stompBox.h"
  2. #include "floorBoard.h"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication app(argc, argv);
  7.  
  8. floorBoard floor;
  9.  
  10. stompBox fx1(&floor);
  11. fx1.setId(0);
  12. fx1.setImage(":/images/fx1.png");
  13. fx1.setPos(floor.getPos(0));
  14.  
  15. QComboBox *fx1_comboBox = new QComboBox(&fx1);
  16. fx1_comboBox->addItem( "Test 1" );
  17. fx1_comboBox->addItem( "Test 2" );
  18. fx1_comboBox->addItem( "Test 3" );
  19.  
  20. fx1_comboBox->setGeometry(8, 31, 79, 13);
  21. fx1_comboBox->setEditable(false);
  22. fx1_comboBox->setFont(font);
  23. fx1_comboBox->setPalette(pal);
  24. fx1_comboBox->setFrame(false);
  25.  
  26. customButton fx1_button(false, QPoint::QPoint(4, 110), &fx1);
  27. customLed fx1_led(false, QPoint::QPoint(41, 4), &fx1);
  28. QObject::connect(&fx1_button, SIGNAL(valueChanged(bool)),
  29. &fx1_led, SLOT(setValue(bool)));
  30.  
  31. floor.show();
  32.  
  33. return app.exec();
  34. };
To copy to clipboard, switch view to plain text mode