Hi, I have crash I can't really understand (and for me it's really dificult to debug Qt in Eclipse on Windows). This is the issue: I have dialog with some Qlistwidget and this dialog needs to send all items from it's qlistwidget to qmain window's list widget. The first time I try to do this, all goes well, but second time (when there are already some items in qmainwindow's qlistwidget) the application crashes.
This is the code for qdialog's method which sends the items to qmain window: (qdialog is child of qmain window, btw)
void Search::transferSelectedResults() //Search inherited QDialog
{
int row;
MTEV_menu * menu=(MTEV_menu *)m_parent;
//MTEV_menu inherited QMain Window
ltwLoadTCTS->selectAll();
QList<QString> list;
{
list.append(item->text());
row=ltwLoadTCTS->row(item); // ltwLoadTCTS is QListWidget * of Search
item1=ltwLoadTCTS->takeItem(row);
delete item1;
}
menu->AddTestItems(list);
accept();
}
void Search::transferSelectedResults() //Search inherited QDialog
{
int row;
QListWidgetItem * item1;
MTEV_menu * menu=(MTEV_menu *)m_parent;
//MTEV_menu inherited QMain Window
ltwLoadTCTS->selectAll();
QList<QString> list;
foreach (QListWidgetItem * item, ltwLoadTCTS->selectedItems())
{
list.append(item->text());
row=ltwLoadTCTS->row(item); // ltwLoadTCTS is QListWidget * of Search
item1=ltwLoadTCTS->takeItem(row);
delete item1;
}
menu->AddTestItems(list);
accept();
}
To copy to clipboard, switch view to plain text mode
this is code for method of qmain window which adds items to it's qlistwidget
void MTEV_menu
::AddTestItems(QList <QString>
&list
) {
{
if (!isInList(item))
TestCases->addItem(item);
//TestCases are QListWidgetItem * of MTEV_menu
}
}
void MTEV_menu::AddTestItems(QList <QString> &list)
{
foreach (QString item, list)
{
if (!isInList(item))
TestCases->addItem(item);
//TestCases are QListWidgetItem * of MTEV_menu
}
}
To copy to clipboard, switch view to plain text mode
Any comments appreciated 
P.S. Any other suggestions on how to do sending items from qdialog to qmainwindow are also welcomed....
Bookmarks