From kde-perl Tue Aug 01 23:13:22 2006 From: "Gary L. Greene Jr." Date: Tue, 01 Aug 2006 23:13:22 +0000 To: kde-perl Subject: Re: [Kde-perl] Why isn't this easy? implementing File->New Message-Id: <200608011913.31664.greeneg () phoenuxos ! com> X-MARC-Message: https://marc.info/?l=kde-perl&m=115447406801298 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0068249521==" --===============0068249521== Content-Type: multipart/signed; boundary="nextPart2153258.XXuU9zIf6i"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart2153258.XXuU9zIf6i Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Joe, try creating the UI under qt designer and then run the resultant UI=20 through uic to generate the initial code for the interface. You'll find tha= t=20 it makes the interface design a WHOLE lot simpler. On Tuesday 01 August 2006 19:00, Joe Carlson wrote: > I am liking PerlQt. At last, some real widgets that enable access to our > Perl infrastructure. I'm a convert. > > Nonetheless, a problem. I'd like to implement a "File->New" menu action > to open a new instance of the main window. In the c++ version, this is > trivial: > > void MyView::processFileMenu(int option) > { > if (option =3D=3D FILENEW) { > MyView *newWindow =3D new MyView(); > newWindow->show(); > } > ... > > and that's it. the new window opens and I have an event loop responding > to it. > > The corresponding perl version (inside MyView.pm which subclasses > Qt::MainWindow): > > package MyView; > ... > use constant FILENEW=3D>1; > ... > sub processFileMenu > { > my $option =3D shift; > if ($option =3D=3D FILENEW) { > my $newWindow =3D main::MyView(); > $newWindow->show; > } > ... > > is not as successful. I can see from the perl debugger that I am calling > MyView::NEW and I am creating a new instance of the main window. But > nothing shows up on the screen. The X event loop continues to process > events from the original main window. > > Am I correct in assuming that I need to invoke the constructor from the > namespace main::? I have been unable to find any other legitimate way to > call it. Are there any alternatives for creating new instances of these > classes directly? > > I looked at some of the trace output from the debugger, and I am left > with the impression that there may be some processing that happens only > the first time a module is autoloaded that prevents new instances from > getting processed by the metaObject-izer. > > Anyone have a suggestion? I haven't stumbled over the solution yet. > > Thanks, > > Joe > > > > _______________________________________________ > Kde-perl mailing list > Kde-perl@kde.org > https://mail.kde.org/mailman/listinfo/kde-perl --nextPart2153258.XXuU9zIf6i Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.20 (GNU/Linux) iD4DBQBEz+AbCkngzK11zHsRApx0AJd1MHWVviacSrPCGRA+26p8e/C/AJ9DwORt 14s2vbF+EumzQLaXfWRceg== =d5Vl -----END PGP SIGNATURE----- --nextPart2153258.XXuU9zIf6i-- --===============0068249521== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kde-perl mailing list Kde-perl@kde.org https://mail.kde.org/mailman/listinfo/kde-perl --===============0068249521==--