-
QSpinBox Right-Click
I have a QSpinBox in the cell of a QTableWidget. When I right-click in the QSpinBox I popup a context menu associated with the table. The problem is the QSpinBox also signals editingFinished whenever it's right-clicked, even if successive right-clicks occur without leaving the spin box. Is there a way to disable this behavior such that I only see editingFinished when enter is pressed or the spin box loses focus?
-
Re: QSpinBox Right-Click
Can you override the QSpinBox's editingFinished function and just ignore the event so it will be passed up to its parent, assuming the table is the parent. You might also have to capture the keyPressEvent to see if Enter was pressed and the focusOutEvent for losing focus. Hope this helps.
-
Re: QSpinBox Right-Click
editingFinished() is a signal, so there is no practical way of overriding it.
-
Re: QSpinBox Right-Click
Sorry I misread his post. He could just connect this signal to a slot and ignore it, right?
-
Re: QSpinBox Right-Click
I am connected to editingFinished, since I want to do something when enter is pressed. In order to handle the SIGNAL as you suggest, I would need to know if it was triggered by a right-click. I considered setting a flag when the contextMenuEvent is called, but I wasn't sure the order (contextMenuEvent vs. editingFinished) could be guaranteed.