Hey there,
I've searched a bit on the forum,
I'm not sure how to update the model from its delegate edit event.
bool ZeChatRoom_delegate
::editorEvent(QEvent *event,
{
const ZeChatRoom_model* modelData = static_cast<const ZeChatRoom_model*>(index.model());
ZeChatRoom_data * chatData = index.data().value<ZeChatRoom_data *>();
if (event
->type
() == QEvent::MouseButtonDblClick) {
//QMouseEvent *mev = (QMouseEvent*)event;
modelData->getService().
OpenChat(chatData->getRoomName() + '@' + modelData->getServer());
chatData->setClicked(true);
// Hey view could you update your display please ?
}
else if (event
->type
() == QEvent::MouseButtonRelease) {
chatData->setClicked(false);
// Hey view could you update your display please ?
}
return false;
}
bool ZeChatRoom_delegate::editorEvent(QEvent *event,
QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index)
{
const ZeChatRoom_model* modelData = static_cast<const ZeChatRoom_model*>(index.model());
ZeChatRoom_data * chatData = index.data().value<ZeChatRoom_data *>();
if (event->type() == QEvent::MouseButtonDblClick)
{
//QMouseEvent *mev = (QMouseEvent*)event;
modelData->getService().
OpenChat(chatData->getRoomName() + '@' + modelData->getServer());
chatData->setClicked(true);
// Hey view could you update your display please ?
}
else if (event->type() == QEvent::MouseButtonRelease)
{
chatData->setClicked(false);
// Hey view could you update your display please ?
}
return false;
}
To copy to clipboard, switch view to plain text mode
Thanks.
Bookmarks