Hello,
In my project, i need to populate a ListView with different item. Those items can have différent nature, and need a custom widget for drawing and editing.
I have build a custom widget (Widget_CarteFille_Gpio) with QDesigner (1 layout, 2 label, 2 combo-box)
Widget_CarteFille_Gpio
::Widget_CarteFille_Gpio (QWidget *parent
) :{
setupUi (this);
}
Widget_CarteFille_Gpio::Widget_CarteFille_Gpio (QWidget *parent) :
QWidget (parent)
{
setupUi (this);
}
To copy to clipboard, switch view to plain text mode
Next, i try to subclass a QItemDelegate who build my new widget for the editing.
{
Widget_CarteFille_Gpio *editor = new Widget_CarteFille_Gpio (parent);
return editor;
}
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
Widget_CarteFille_Gpio *editor = new Widget_CarteFille_Gpio (parent);
return editor;
}
To copy to clipboard, switch view to plain text mode
I build the project, and exec the application !
When I double click on the item my widget is not show !
I read this exemple : http://doc.qtsoftware.com/4.5/itemvi...rdelegate.html but they draw directly on a widget, this is little different of my problem.
If someone have a code exemple about draw a custom widget for viewing/editing in a ListView. I was very interresting.
Thanks
Apologize for my English !
Bookmarks