[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: Bug#4656: konqueror : Default keys to delete files
From: David Faure <david () mandrakesoft ! com>
Date: 2000-06-30 7:53:05
[Download RAW message or body]
On Thu, Jun 29, 2000 at 07:41:39PM -0400, Dawit Alemayehu wrote:
> On Thu, 29 Jun 2000, David Faure wrote:
> > IIRC there's an easy way to know which widget has the focus - QApplication::focus_widget.
> > I'd rather ask this one. But the QWidget part of the patch would be the same in
> > this solution too.
>
> Hmm.... trying to do as little work as possible eh ?? :))
No, thinking modular.
Think about the fact that you wanted to use that for KLineEdit
(or was it KComboBox). Are you going to require that everyone using
it writes a method in the KTMW-derived class, to catch some
particular events that the lineedit wants to handle itself ?
Sounds wrong to me :-)
> How about the following code then:
>
> // Default to current behavior.
> bool allowAccelEvent = true;
>
> // Get the widget that has the current focus
> QWidget* w = qApp->focusWidget();
>
> // Check focusWdget does not return NULL and make sure
> // the top level widget that contains the widget with focus
> // is the one we are currently watching...
Always good to check, but I fail to see when this would not be true.
If a widget has the focus, then it means its toplevel widget is active,
otherwise it wouldn't have the focus :-)
(AFAIK)
> if ( w && w->topLevelWidget() == d->watch )
> allowAccelEvent = w->allowAcceleratorEvent( k ); // Query the widget with focus
>
> if ( allowAccelEvent )
>
> The only problem with this approach is that the application programmer has no
> control over what he wants to do in his application but rather the individual
> widgets. I guess application programmers can always inherit and override the
> implementation in any particular widget if they choose to...
Right - but if someone defines a KAction/QAccel with "Del", he certainly
does not want that to prevent deleting a char from a lineedit...
--
David FAURE
david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic