hi, i have a problem that i can't solve for the moment.
I have a list where i load a list of messages, each message is displayed in a widget panel.
i'm trying to perform go up & down actions with a up & down buttons and i don´t know how to remove a widget and insert it again one position before.
could anyone help me??
here there are some code:
QWidget *scrollWidget
= ui.
scrollTx;
QLayout *layout
= scrollWidget
->layout
();
//this code is to remove panels that they already are in the list
while ((child = layout->takeAt(0)) != 0)
{
if (widget) widget->deleteLater();
delete child;
}
// with this code i create the panels
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++;
}
QWidget *scrollWidget = ui.scrollTx;
QLayout *layout = scrollWidget->layout ();
//this code is to remove panels that they already are in the list
QLayoutItem *child = 0;
while ((child = layout->takeAt(0)) != 0)
{
QWidget *widget = child->widget();
if (widget) widget->deleteLater();
delete child;
}
// with this code i create the panels
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 ();
To copy to clipboard, switch view to plain text mode
but afterthat in other function i need to insert panels between some of them,
and i just have found this method to insert widgets: layout->addWidget (panel);
can i perform what i want?
thanks anyway
Bookmarks