how to implement the listwidget delegate?thanks
i want to implement the listwidget delegate,the code as follows:
Code:
{
if(index.column()==0)
{
return editor;
}
else{
}
}
{
if(index.column()==0)
{
QListWidget* editor
=qobject_cast<QListWidget
*>
(editor
);
editor->addItem("eg1");
editor->addItem("eg2");
editor->addItem("eg3");
editor->addItem("eg4");
editor->setCurrentRow(1);
}
else {
}
}
{
if(index.column()==0)
{
QListWidget* editor
=qobject_cast<QListWidget
*>
(editor
);
model->setData(index,editor->currentItem()->text(),Qt::EditRole);
}
else {
}
}
but not successfully,why, help me , thanks!
Re: how to implement the listwidget delegate?thanks
What do you want to achieve? Returning a list widget as a editor looks strange. How about a QComboBox?
Re: how to implement the listwidget delegate?thanks
i implement the QComboBox delegate,and i want to know how to implement a listwidget editor or a tablewidget editor even a custom widget (eg. a tablewidget + a pushbutton)? without regard to the list widget's strange looks,how to do it?thanks.