Custom QWidgetListItem and casting
mookie last edited by
I have subclassed the QWidgetListItem and im trying to implement the ability of double clicking it and then populating the data into a dialog to give the user the ability to change the properties of the item.
my problem is that i dont know how to cast the item properly.
using qobject_cast doesnt seem to work properly.
one of my problems is admittedly that im still new to c++ coming from c# world.
so if i have
class CustomItem: public QListWidgetItem
but in my qlistwidget i have
void CustomListWidget::on_CustomListWidget_itemDoubleClicked(QListWidgetItem *item)
qDebug()<<"Show Item Dialog";
how can i cast it so i can pass it along?
[edit: Added missing coding tags @ SGaist]
QListWidgetItem is not a QObject thus qobject_cast will fail. In this case, you can use a dynamic_cast.