[QScintilla] Shift+Tab for unindent

Andrei Kopats hlamer at tut.by
Mon Feb 7 11:25:51 GMT 2011


Yes, code works, if we do event.accept()

Phil, is it possible to do such hack inside QScintilla?


На 07.02.2011 10:52, Phil Thompson напісаў(ла):
> On Sun, 6 Feb 2011 12:50:44 -0600, Steve Borho<steve at borho.org>  wrote:
>> 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?
> Call event.accept() rather than event.ignore()?
>
> Phil
> _______________________________________________
> QScintilla mailing list
> QScintilla at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/qscintilla



More information about the QScintilla mailing list