[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-perl
Subject: [Kde-perl] Why isn't this easy? implementing File->New
From: Joe Carlson <joe () fruitfly ! org>
Date: 2006-08-01 23:00:58
Message-ID: 1154473258.1691.76.camel () torso ! lbl ! gov
[Download RAW message or body]
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 == FILENEW) {
MyView *newWindow = 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=>1;
...
sub processFileMenu
{
my $option = shift;
if ($option == FILENEW) {
my $newWindow = 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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic