[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: Dawit Alemayehu <adawit () kde ! org>
Date: 2000-06-29 23:41:39
[Download RAW message or body]
On Thu, 29 Jun 2000, David Faure wrote:
> On Thu, Jun 29, 2000 at 06:39:59PM -0400, Dawit Alemayehu wrote:
> > On Thu, 29 Jun 2000, David Faure wrote:
> > > On Thu, Jun 29, 2000 at 03:19:02PM -0400, Dawit Alemayehu wrote:
[snipped]
> Ah... I see now.
> Well, that would work but it's a centralised solution: it means the toplevel widget
> has to take care of it all.
>
> I think that, given what we want to do, it's rather to the widget that has
> the focus that we want to ask what to do. This makes it possible to use
> a widget that catches some keypress events, without having to write something
> it MyMainWindow::allowAccelerator().
>
> 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 ?? :)) 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...
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...
Regards,
Dawit A.
// who has to recompile everything just to check this mess :((
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic