[QScintilla] Shift+Tab for unindent
Steve Borho
steve at borho.org
Sun Feb 6 18:50:44 GMT 2011
On Sun, Feb 6, 2011 at 9:22 AM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Tue, 25 Jan 2011 16:19:49 +0200, Андрей <hlamer at tut.by> wrote:
>> Hi
>>
>> Scintilla uses Shift+Tab for unindent by default. But, if I press it in
>> Qt4/QScintilla application, focus jumps to another widget, because Qt
> uses
>> Shift+Tab for move focus.
>>
>> I checked qt4 example - Shift+Tab doesn't work here, but works in the
> GTK
>> scite.
>>
>> How to resolve this situation?
>
> It will be fixed in tonight's snapshot.
>
> You can also apply the fix in your application by reimplementing
> keyPressEvent(), check to see if the key pressed is Key_Backtab and, if so,
> update the event so that it appears to be a Key_Tab with the shift
> modifier, then call the original keyPressEvent().
I've done this:
def keyPressEvent(self, event):
if event.key() == Qt.Key_Backtab:
event.ignore()
newev = QKeyEvent(event.type(), Qt.Key_Tab, Qt.ShiftModifier)
super(MessageEntry, self).keyPressEvent(newev)
else:
super(MessageEntry, self).keyPressEvent(event)
And it does do the back shift, but then the qsci widget loses focus.
Is there a way to avoid that?
Thanks.
--
Steve Borho
More information about the QScintilla
mailing list