I have this problem:
I have 2 types of panels that i need to add or insert inside a qscrollarea:
PanelTx (CArincMsgData *msg, ListaMensajes &listaMensajes, QWidget *parent = 0);
PanelTxParams(QWidget *parent, CArincParam * param, std::string label);

Two types are almost identical, they have the same dimension, cause the second one is a copy of the first one but with other label and fields.

my problem is that when i insert or add to the qscrollarea layout the first type of panel there is no problem, but with the second one i have problems at the time of display them.

i ahve this function to load the panels at the beginning or the program, and it works perfectly.
Qt Code:
  1. ....
  2. QWidget *scrollWidget = ui.scrollTx;
  3. QVBoxLayout *layout = (QVBoxLayout*) scrollWidget->layout ();
  4.  
  5. for (it = m_cListaTx.begin (); it != m_cListaTx.end ();)
  6. {
  7. CArincMsgData *msg = *it;
  8. if (msg)
  9. {
  10. PanelTx *panel = new PanelTx (msg, *this, layout->widget ());
  11. layout->addWidget (panel);
  12. m_cListaPanelsTx[msg->getLabel ()] = panel; // almaceno el panelTx en la lista(map)
  13.  
  14. if(!msg->isEnabledTx() && ui.btnEnableAllTx->isChecked()) //aqui compruebo si hay alguno q no esta habilitado
  15. ui.btnEnableAllTx->setChecked(false);
  16. }
  17. it++;
  18. }
  19. ((QVBoxLayout *)layout)->addStretch ();
  20. ....
To copy to clipboard, switch view to plain text mode 

but i have this other function

Qt Code:
  1. ....
  2. QWidget *scrollWidget = ui.scrollTx;
  3. QVBoxLayout *layout = (QVBoxLayout*) scrollWidget->layout ();
  4. for(int j = 0; j < params.size(); j++)
  5. {
  6.  
  7. PanelTx *panelParametro = new PanelTx (msg, *this, layout->widget ());
  8. layout->insertWidget(++i,panelParametro);
  9. }
  10. ...
To copy to clipboard, switch view to plain text mode 
with this function i insert int he position that i need (between other panels) as many panels as parameters has the message.

if the panel is this type: PanelTx, the same type as the panels loaded at the first function, there is no problem and they are inserted.

but if i use this other panel..

Qt Code:
  1. ....
  2. QWidget *scrollWidget = ui.scrollTx;
  3. QVBoxLayout *layout = (QVBoxLayout*) scrollWidget->layout ();
  4. for(int j = 0; j < params.size(); j++)
  5. {
  6.  
  7. PanelTxParams *panelParametro = new PanelTxParams (layout->widget(),params[j],msg->getStrLabel ());
  8. layout->insertWidget(++i,panelParametro);
  9. }
  10. ...
To copy to clipboard, switch view to plain text mode 

i have problems with displaying them. They dont appear but, some elements inside the layout are created (as many as panels i insert). i know that using layout->count()
And some space is used at the end of the layout, but they aren't displayed.

does anyone know the reason, or the solution?

thanks a lot