1 Attachment(s)
Re: QAbstractItemView::entered signal does not fire for QTreeView row when row has wi
When I add a widget to a row in a QTreeView using setIndexWidget(), the QAbstractItemView::entered signal, used to detect when the mouse hovers over a row, does not fire unless the mouse is over the part of the row that the QWidget does not occupy.
See picture below that shows 3 rows.
Attachment 13019
When the mouse enters the white space it works, but if it enters the green space (the QWidget) it does not. How do I fix this?
This is how the QWidget is put in the row. The QWidget is necessary because I need a clickable button in each row
Code:
CustomItem* item= new CustomItem(_uiDoc, *sketch);
parent->appendRow(item);
setIndexWidget(item->index(), item->GetWidget());
Added after 1 15 minutes:
This was the soluton
Code:
item->GetWidget()->setAttribute(Qt::WA_TransparentForMouseEvents);
Re: QAbstractItemView::entered signal does not fire for QTreeView row when row has wi
Quote:
Originally Posted by
Dkrii
When I add a widget to a row in a QTreeView using setIndexWidget(), the QAbstractItemView::entered signal, used to detect when the mouse hovers over a row, does not fire unless the mouse is over the part of the row that the QWidget does not occupy.
See picture below that shows 3 rows.
Attachment 13019
When the mouse enters the white space it works, but if it enters the green space (the QWidget) it does not. How do I fix this?
This is how the QWidget is put in the row. The QWidget is necessary because I need a clickable button in each row
Code:
CustomItem* item= new CustomItem(_uiDoc, *sketch);
parent->appendRow(item);
setIndexWidget(item->index(), item->GetWidget());
Added after 1 15 minutes:
This was the soluton
Code:
item->GetWidget()->setAttribute(Qt::WA_TransparentForMouseEvents);
nevermind, that made the widget then unusable.
Re: QAbstractItemView::entered signal does not fire for QTreeView row when row has wi
Quote:
Originally Posted by
Dkrii
nevermind, that made the widget then unusable.
And that's the reason why the view does not get events - the widget needs it and doesn't pass it to the view. You have to do it on your own. E.g. by reimplementing QWidget::focusInEvent()