i have user interface uses tableview. has 3 columns. last column has combobox. data inserted delegate. problem can not find method send signal public slot of user interface class when combobox index changed. delegate know current index. know method send index ui? not think possible solution signals , slots. direct solution extract data?
edit
what understand have this:
void delegate :: setmodeldata(qwidget *editor, qabstractitemmodel *model, const qmodelindex &index) const { if(index.column() == col_coordonate) // test if @ last column { qcombobox *combobox = static_cast<qcombobox*>(editor); model -> setdata(index, combobox -> currentindex(), qt::editrole); emit datachanged(combobox -> currentindex(),combobox -> currentindex()); // have in mind? } }
and how can receive index in user interface? create model in there like:
qstandarditemmodel *model; delegate *mydelegate;
and use them like:
mydelegate = new delegate(this); model = new qstandarditemmodel(0, 3, this); // add rows dynamically ui -> tableview -> setmodel(model); ui -> tableview -> setitemdelegate (mydelegate);
i add data delegate when press button. need trigger slot interface? if can please provide sample of code how do this?
you have qcombobox
instance. can connect signals. not know? in case, should not connecting delegate: implementation detail of view. should interface model, not view. connect model's datachanged
signal!
Comments
Post a Comment