[Interest] Button in front of table

Volker Hilsheimer volker.hilsheimer at qt.io
Thu Jun 10 13:22:19 CEST 2021



> On 10 Jun 2021, at 12:55, Turtle Creek Software <support at turtlesoft.com> wrote:
> 
> We have a QTableWidget with cells containing our QWidget subclasses.  One of them adds a temporary popup menu button and a scrolling list when clicked.
> 
> They display OK, but clicking on them falls through to the cell widget behind them. raise() didn't help.
> 
> We can intercept all clicks and figure if they should go to a temporary object, but is there an easier way to put something in front of a QTableWidget and have it accept mouse clicks?
> 
> Thanks, Casey McD

Hey Casey,

Would be good to see some code. I assume your widget subclass handles mousePressEvent to show a toplevel QWidget of Qt::Popup type, and that popup widget displays a scrolling list (perhaps it is a QListView, or it contains a QListView, or it does everything itself)? Mouse events going to that popup should not propagate beyond it. Or are you not using a popup-type toplevel widget?

If you have a completely custom widget for the scrolling list view, are you ignoring any events (they are accepted by default, the default implementation of QWidget::mousePress/ReleaseEvent ignores them to let them propagate through the hierarchy).

Volker




More information about the Interest mailing list