Hi,

I have a layout filled with 2 widgets.
I would like to replace one of the widgets of the layout using a signal/slot mechanism.

What do I need to do so that the layout is repainted/refreshed using the new widget after the widget has been changed ?

Qt Code:
  1. DriverView::DriverView( QWidget* parent ) :
  2. QWidget( parent )
  3. {
  4. // Title
  5. title = new TitleFrame(this,"Actual Driver");
  6. // Body
  7. body = driverFactory()->driverUserInterface(driverFactory()->currentDriver());
  8.  
  9. // Layout
  10. QVBoxLayout *mainLayout = new QVBoxLayout;
  11. mainLayout->addWidget(title);
  12. mainLayout->addWidget(body);
  13. mainLayout->setContentsMargins (0, 0, 0, 0);
  14. setLayout(mainLayout);
  15.  
  16. connect(driverFactory(),SIGNAL(driverHasChanged()), this, SLOT(refreshDriverView()));
  17. }
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. void
  2. DriverView::refreshDriverView() {
  3. body = driverFactory()->driverUserInterface(driverFactory()->currentDriver());
  4. // repaint(); doesn't work
  5. // update(); doesn't work
  6. }
To copy to clipboard, switch view to plain text mode