pakine
25th August 2010, 11:48
Hi to all, i have one problem with a QVBoxLayout.
at first a list of messages are loaded into a QScrollArea. Those panels(messages) have a button to display its parameters in other panels below the message panel.
The problem is that when i try to insert the parameters penls below the message panel, they are displayed with space between them, and i dont know hot to display them together with no space.
here is the code to load the messages.It works well.
QWidget *scrollWidget = ui.scrollTx;
QVBoxLayout *layout = (QVBoxLayout*) scrollWidget->layout ();
//Creo los nuevos paneles y los añado a la lista.
for (it = m_cListaTx.begin (); it != m_cListaTx.end ();)
{
CArincMsgData *msg = *it;
if (msg)
{
PanelTx *panel = new PanelTx (msg, *this, layout->widget());
layout->addWidget (panel);
}
it++;
}
((QVBoxLayout *)layout)->addStretch ();
when i addStretch, all the panels are displayed together with no space between them..
and here is the code i have problems with
QWidget *scrollWidget = ui.scrollTx;
QVBoxLayout *layout = (QVBoxLayout *)scrollWidget->layout ();
int i;
for (i = 0, it = m_cListaTx.begin(); it != m_cListaTx.end (); it++, i++)
{
//localizo el panel
msg = *it;
panel = m_cListaPanelsTx[msg->getLabel()];
if( label == atoi(msg->getStrLabel().c_str ()) )
{
//when i locate the message i create as many parameter panel as it has
params = msg->getParametros ();
for(int j = 0; j < params.size(); j++)
{
OutputDebugStringA ("voy a insertar un panel\n");
//create a panel
PanelTxParams *panelParametro = new PanelTxParams (layout->widget(),params[j],msg->getStrLabel ());
layout->insertWidget(++i,panelParametro);
}
......
in this part im not using addstretch() cause i have used at messages loading. But if i use it the result is not the desirable.
when i insert the parameters panels they are not displayed together, but they are displayed with some lines of space between them.
other thing is that in other function i have to insert the same message panels and it works fine, but with those new panels (parameter panels) the result is different.
how can i get this working fine?
thanks a lot
at first a list of messages are loaded into a QScrollArea. Those panels(messages) have a button to display its parameters in other panels below the message panel.
The problem is that when i try to insert the parameters penls below the message panel, they are displayed with space between them, and i dont know hot to display them together with no space.
here is the code to load the messages.It works well.
QWidget *scrollWidget = ui.scrollTx;
QVBoxLayout *layout = (QVBoxLayout*) scrollWidget->layout ();
//Creo los nuevos paneles y los añado a la lista.
for (it = m_cListaTx.begin (); it != m_cListaTx.end ();)
{
CArincMsgData *msg = *it;
if (msg)
{
PanelTx *panel = new PanelTx (msg, *this, layout->widget());
layout->addWidget (panel);
}
it++;
}
((QVBoxLayout *)layout)->addStretch ();
when i addStretch, all the panels are displayed together with no space between them..
and here is the code i have problems with
QWidget *scrollWidget = ui.scrollTx;
QVBoxLayout *layout = (QVBoxLayout *)scrollWidget->layout ();
int i;
for (i = 0, it = m_cListaTx.begin(); it != m_cListaTx.end (); it++, i++)
{
//localizo el panel
msg = *it;
panel = m_cListaPanelsTx[msg->getLabel()];
if( label == atoi(msg->getStrLabel().c_str ()) )
{
//when i locate the message i create as many parameter panel as it has
params = msg->getParametros ();
for(int j = 0; j < params.size(); j++)
{
OutputDebugStringA ("voy a insertar un panel\n");
//create a panel
PanelTxParams *panelParametro = new PanelTxParams (layout->widget(),params[j],msg->getStrLabel ());
layout->insertWidget(++i,panelParametro);
}
......
in this part im not using addstretch() cause i have used at messages loading. But if i use it the result is not the desirable.
when i insert the parameters panels they are not displayed together, but they are displayed with some lines of space between them.
other thing is that in other function i have to insert the same message panels and it works fine, but with those new panels (parameter panels) the result is different.
how can i get this working fine?
thanks a lot