Hi all
I am activating combobox at run time in following slot
list_combobox.clear();
for(int i=0; i<obj_schedule_table->rowCount(); i++)
{
widget1 = obj_schedule_table->cellWidget(i,3);
combo->setEditable(false);
list_combobox<<combo;
}
for(int i=0; i<list_combobox.size(); i++)
{
signalMapper_selection->setMapping(list_combobox.at(i), i);
connect(list_combobox.
at(i
),
SIGNAL(activated
(QString)), signalMapper_selection,
SLOT (map
()));
connect(signalMapper_selection, SIGNAL(mapped(int)), this, SLOT(set_item_combobox_type(int)));
}
list_combobox.clear();
for(int i=0; i<obj_schedule_table->rowCount(); i++)
{
QWidget *widget1;
widget1 = obj_schedule_table->cellWidget(i,3);
QComboBox *combo = (QComboBox*)widget1->children().at(1);
combo->setEditable(false);
list_combobox<<combo;
}
signalMapper_selection = new QSignalMapper(this);
for(int i=0; i<list_combobox.size(); i++)
{
signalMapper_selection->setMapping(list_combobox.at(i), i);
connect(list_combobox.at(i), SIGNAL(activated(QString)), signalMapper_selection, SLOT (map()));
connect(signalMapper_selection, SIGNAL(mapped(int)), this, SLOT(set_item_combobox_type(int)));
}
To copy to clipboard, switch view to plain text mode
this slot is called on clicking a button "edit"
in remove_row slot i again connect these combobox to appropriate slots
disconnect(list_combobox.at(index),0,0,0);
obj_schedule_table->removeRow(index);
list_combobox.removeAt(index);
for(int i=0; i<obj_schedule_table->rowCount(); i++)
{
signalMapper_selection->setMapping(list_combobox.at(i), i);
connect(list_combobox.
at(i
),
SIGNAL(activated
(QString)), signalMapper_selection,
SLOT (map
()));
connect(signalMapper_selection, SIGNAL(mapped(int)), this, SLOT(set_item_combobox_type(int)));
}
signalMapper_selection = new QSignalMapper(this);
QLineEdit *line_edit = (QLineEdit *)obj_schedule_table->cellWidget(index,0);
disconnect(list_combobox.at(index),0,0,0);
obj_schedule_table->removeRow(index);
list_combobox.removeAt(index);
for(int i=0; i<obj_schedule_table->rowCount(); i++)
{
signalMapper_selection->setMapping(list_combobox.at(i), i);
connect(list_combobox.at(i), SIGNAL(activated(QString)), signalMapper_selection, SLOT (map()));
connect(signalMapper_selection, SIGNAL(mapped(int)), this, SLOT(set_item_combobox_type(int)));
}
To copy to clipboard, switch view to plain text mode
When i remove a row and than activate a combobox in row below than that row it give segmantaion fault while working fine above the removed row.
Please help me what i am doing wrong.
Bookmarks