Chris: I'm not sure if that's the most desirable behaviour, as it differs from the rest of the Perl world... Also, one useful thing is that if you want to create an object of something in Perl you could do:
my $foo = Foo::Bar->new(); my $bar = $foo->new(); Which would create a $bar of the same type as $foo. You lose this by dropping the ->new part. I'm sure there's other very good reasons as to why those sorts of constructors are a bad idea. Jonathan On Tue, May 26, 2009 at 2:20 PM, Chris Burel <[email protected]> wrote: > No, > Check out this document from Germain Garand wrote for PerlQt3: > http://web.mit.edu/perlqt_v3.009/www/index.html#anatomy_of_perlqt > > Syntax elements summary : > 1. All Qt classes are accessed through the prefix Qt::, which > replaces the initial Q of Qt classes. When browsing the Qt > documentation, you simply need to change the name of classes so that > QFoo reads Qt::Foo. > 2. An object is created by calling the constructor of the class. It > has the same name as the class itself. > You don't need to say new Qt::Foo or Qt::Foo->new() as most Perl > programmers would have expected. > Instead, you just say : > my $object = Qt::<classname>(arg_1, ..., arg_n); > If you don't need to pass any argument to the constructor, simply say : > my $object = Qt::<classname>; > > On Tue, May 26, 2009 at 11:13 AM, Jonathan Yu <[email protected]> wrote: >> On Tue, May 26, 2009 at 2:08 PM, Chris Burel <[email protected]> wrote: >>> It's currently neither. Right now it looks like this: >>> use Qt; >>> my $app = Qt::Application(\...@argv); >>> my $hello = Qt::PushButton("Hello world!"); >> I'm guessing you meant to say Qt::PushButton->new(...) :-) >>> $hello->show(); >>> etc. >>> Which I realize is a problem. >>> >>> On Tue, May 26, 2009 at 11:00 AM, Jonathan Yu <[email protected]> >>> wrote: >>>> Chris: >>>> >>>> Is it Qt4::Application or QApplication (as it was in Qt - ie version 1?) >>>> >>>> On Tue, May 26, 2009 at 1:59 PM, Chris Burel <[email protected]> wrote: >>>>>> And really, what's wrong with Qt4::Application->new()? >>>>> >>>>> I've been modeling the Qt4 bindings off the Qt3 ones that Ashley and >>>>> Germain wrote. And that's how it works in 3, so I kept it. >>>>> >>>> >>> >> >
