text area focus and key shortcuts -- bug or feature?
David Faure
dfaure at klaralvdalens-datakonsult.se
Wed Oct 15 09:13:00 BST 2003
On Wednesday 15 October 2003 06:55, Jesse Yurkovich wrote:
> Hello,
> I've been hooked on multiple konsole sessions for quite a while now and have
> grown accostumed to the very fast and natural shift-left, shift-right key
> shortcuts to switch between sessions -- or tabs in konsole now.
>
> So I proceded to change my shortcuts to Konqueror for these actions. However,
> I was supprised to find out that while I was editing some text in a form text
> area, as soon as I hit shift-left to select some text ... well you can guess
> what happened -- konq switched tabs :(
>
> I have the 'Backspace' key mapped to 'Back' and that works fine i.e., If konq
> has the focus hitting Backspace goes Back in history and if a text area has
> focus a Backspace is entered.
>
> Is it the desired behavior with tab switching ? Why can't the event make it
> to the text area first before being filtered by konq?
I agree that it should - and this is done with catching the AccelOverride event
in the text area. It probably doesn't do that for arrow keys, since Qt didn't expect
that someone would bind this to a window-global accel :)
Hmmmmmm but QLineEdit has the code for it. QLineEdit::event says
if ( e->type() == QEvent::AccelOverride && !d->readOnly ) {
QKeyEvent* ke = (QKeyEvent*) e;
if ( ke->state() == NoButton || ke->state() == ShiftButton
|| ke->state() == Keypad ) {
if ( ke->key() < Key_Escape ) {
ke->accept();
} else if ( ke->state() == NoButton
|| ke->state() == ShiftButton ) {
switch ( ke->key() ) {
case Key_Delete:
case Key_Home:
case Key_End:
case Key_Backspace:
case Key_Left:
case Key_Right:
ke->accept();
default:
break;
}
}
Oh - were you talking about a multi-line text area?
QTextEdit has very similar code - but misses Key_Left and Key_Right.
Patch attached, please test.
Cc'ing qt-bugs (please remove the CC before replying).
--
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtextedit.cpp.diff
Type: text/x-diff
Size: 496 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20031015/5d3835b4/attachment.diff>
More information about the kfm-devel
mailing list