<div id="__MailbirdStyleContent" style="font-size: 12pt;font-family: Candara;color: #000000">Hi.  [Windows 10/Python 3.7.1/PyQt 5.11.3; My first time posting here, 
so please pardon in advance if anything is not quite right ...]
<br><br>I have a QTableView with associated QAbstractTableModel.  The View uses a Delegate that creates a QLineEdit widget for cell editing.
<br><br>I think (I hope) what I'm trying to do is conceptually very simple: 
 When editing in a cell is in progress, I want to prevent departure from
 the cell.  (This would typically be under circumstances where the cell 
contents are determined not to be valid).  For example, while editing 
the contents of a cell, the user hits Tab to move to the next cell.  I 
want to suppress that and leave the cursor right where it is, as though 
nothing happened.
<br><br>After reading the QEvent documentation, I think I should be able
 to do this by filtering and suppressing either the FocusAboutToChange 
or FocusOut events.
<br><br>So I define a QObject to serve as the event filter, and gave it 
an eventFilter() method.  Then I use installEventFilter() to install it 
as the event filter for the QLineEdit.
<br><br>If I start editing in a cell, then hit (for example) the Tab key, the eventFilter() method properly detects the FocusAboutToChange and FocusOut events.  eventFilter() returns True for both of these, which should (I think) stop processing of the events.<br><br>But it doesn't.  Focus moves to the next cell anyhow, in spite of the filter. <br><br>From everything I've read, I'd have thought I was doing this right.  What am I overlooking?
<br><br>Thanks! <div><br></div><div><i>Since I haven't posted here before, I'm not exactly sure how to include sample code.  I'll try adding them as attachments to the e-mail, but here are links as well:</i><br><br><div class="mb_sig"></div><div><span style="font-size: 12pt;color: rgb(0, 0, 0)"><a href="http://www.sturtz.org/john/test.py">test.py</a>  [QTableView, Delegate, editor widget and event filter definitions, and __main__]</span></div><div><span style="font-size: 12pt;color: rgb(0, 0, 0)"><a href="http://www.sturtz.org/john/model.py">model.py</a>  [QAbstractTableModel definition, imported by test.py]</span></div></div></div>