[Kde-perl] Why does SUPER->focusInEvent not work?
Matthew Pressly
mpressly at claborn.net
Thu Jul 1 19:30:08 CEST 2004
I'm trying to reimplement focusInEvent and focusOutEvent in a subclass of a
LineEdit
widget unsuccessfully. I basically just need to be able to execute some
code whenever
a focusInEvent or focusOutEvent occurs, in addition to whatever would have
normally
happened.
I've done quite a bit of searching for information on this, and the code
below is what
I think from the PerlQt documentation should work, but it gives an error:
--- No method to call for :
QLineEdit::focusInEvent()
If I comment out the SUPER->focusInEvent and SUPER->focusOutEvent calls,
then the print statements get executed, so sub focusInEvent and sub
focusOutEvent
get called properly, but I need a way to also call the standard
focusInEvent and focusOutEvent
in the super class to get the widget to handle focus properly.
Am I doing something wrong? Is there a different approach I can take to
subclass
a LineEdit widget and add some additional code to be executed whenever the
object
loses or gains focus?
Any help would be greatly appreciated.
package LineEditFocus;
use strict;
use warnings;
use Qt;
use Qt::isa qw(Qt::LineEdit);
use Qt::slots
got_focus => [];
sub NEW {
shift->SUPER::NEW(@_);
}
sub focusInEvent {
print "focus in event\n";
SUPER->focusInEvent();
}
sub focusOutEvent {
print "focus in event\n";
SUPER->focusInEvent();
}
1;
--
Matthew
More information about the Kde-perl
mailing list