@SGaist thanks that seems the right direction, however i cant get the mouse position to be into the checkbox. Visually it looks like i click into the check box but my debug says its not clicking into the checkbox. I tried mapping to global in order to align both positions but i had no luck with this:
bool ViewLayerItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) { if(event->type() == QEvent::MouseButtonPress) { QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); QWidget *parentWidget = qobject_cast<QWidget*>(parent()); if(parentWidget) { QWidget *editor = createEditor(parentWidget, option, index); LineEditCheckBoxWidget *widget = qobject_cast<LineEditCheckBoxWidget*>(editor); if(widget) { QPoint mousePosition = widget->checkBox->mapFromGlobal(mouseEvent->globalPos()); QRect checkboxGeometry = widget->checkBox->geometry(); QRect globalCheckboxGeometry; globalCheckboxGeometry.setTopLeft(widget->checkBox->mapToGlobal(checkboxGeometry.topLeft())); globalCheckboxGeometry.setBottomRight(widget->checkBox->mapToGlobal(checkboxGeometry.bottomRight())); qDebug() << "Checkboxdata: " << globalCheckboxGeometry; qDebug() << "MousePostion: " << mousePosition; /* //IGNORE: later i want to check here if the positon //is the same in order to perform further actions bool checked = widget->checkBox->isChecked(); widget->checkBox->setChecked(!checked); setModelData(editor, model, index); return true; */ } } } return QStyledItemDelegate::editorEvent(event, model, option, index); }I get for example:
Checkboxdata: QRect(1095,302 100x30)
MousePostion: QPoint(215,21)