[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-perl
Subject: Re: [Kde-perl] Perl QT: Problem using a custom Qt::Validator with a
From: Ashley Winters <jahqueel () yahoo ! com>
Date: 2006-02-18 3:29:01
Message-ID: 20060218032901.50520.qmail () web50915 ! mail ! yahoo ! com
[Download RAW message or body]
It might be a bug. Try this:
sub validate {
my($string, $pos) = @_;
print "Validate!\n";
return this->Acceptable;
}
Ashley Winters
--- Stephan Bosch <sirius@drunksnipers.com> wrote:
> Hello,
>
> I am currently using PerlQt-3.008 (using Qt-3.3.3) for a simple
> design.
> I am trying to build a custom Validator for a special LineEdit I
> need. I
> have subclassed the Qt::Validator class with a very much empty
> validate() method (it simply returns Qt::Validator::Acceptable).
> However, when I have assigned an instance of the new Validator class
> to
> my LineEdit, the program crashes with a segfault as soon as the text
> in
> the LineEdit is edited.
>
> The new validator class is structured as follows:
>
> package TestValidator;
> use Qt;
>
> use Qt::isa qw(Qt::Validator);
>
> sub NEW {
> shift->SUPER::NEW($_[0]);
>
> print "New validator!\n";
> }
>
> sub validate {
> my($string, $pos) = @_;
> print "Validate!\n";
>
> return &Qt::Validator::Acceptable;
> }
>
> 1;
>
> The validator is assigned to the LineEdit as follows (where 'this' is
> an
> instance of Qt::Dialog and edtTest is a Qt::LineEdit):
>
> my $v = TestValidator( this );
> edtTest->setValidator( $v );
>
> Upon editing the LineEdit the program crashes as follows:
>
> New validator!
> Validate!
> Use of uninitialized value in subroutine entry at
> /usr/lib/perl5/Qt.pm
> line 445.
> Segmentation fault
>
> Unfortunately the Qt::debug feature does not yield any useful data.
> It
> simply states that the validate method is called.
>
> Does any of you know what causes this segfault? Is it a bug or am I
> doing something wrong? A working perl-Qt example regarding custom
> validators would be very much appreciated.
>
> Regards,
>
> Stephan.
>
> _______________________________________________
> Kde-perl mailing list
> Kde-perl@kde.org
> https://mail.kde.org/mailman/listinfo/kde-perl
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Kde-perl mailing list
Kde-perl@kde.org
https://mail.kde.org/mailman/listinfo/kde-perl
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic