small issue...
"Gary L. Greene Jr." <[email protected]> Sun, 21 Nov 2004 01:33:19 -0500
| Newsgroups | gmane.comp.kde.devel.perl |
|---|---|
| Organization | Paradise Technology Group |
| Message-ID | <[email protected]> |
I'm currently developing a first boot wizard for Ark Linux. I've run into a small problem with my applications design though. I've made the top, middle and bottom of the application window a separate sub. Unfortunately, I need to be able to access the widgetstack in the sub midFrame and Perl keeps saying that I cannot access it. is there a way to allow the other sub calls to access widgets created inside the other calls? Attached is the source to the app thus far. Thanks. -- Gary L. Greene, Jr. Sent from uriel 01:24:40 up 6 days, 8:25, 8 users, load average: 0.12, 0.05, 0.01 ============================================================ Developer for the Ark Linux Project check out http://www.arklinux.org/ for more info. Also http://www.csis.gvsu.edu/~greeneg/ EMAIL : [email protected] ============================================================ Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html for more information. Consider using a free MS-Office replacement for most platforms, http://www.openoffice.org/ _______________________________________________ Kde-perl mailing list [email protected] https://mail.kde.org/mailman/listinfo/kde-perl
aftwizard.pl
(application/x-perl, 4.8 KB)
#!/usr/bin/perl -w
package mainWidget;
use strict;
use Qt;
use Qt::isa "Qt::VBox";
use stackPage;
sub NEW {
shift->SUPER::NEW( @_ );
this->setPaletteBackgroundColor( &Color( 97, 148, 216 ) );
this->setPaletteForegroundColor( &Color( 255, 255, 255 ) );
topFrame();
midFrame();
btmFrame();
}
sub topFrame {
my $f = Qt::Font( Qt::Font( "Bitstream Vera Sans" ) );
my $tFrame = Qt::Frame( this, 0, 0 );
$tFrame->setPaletteBackgroundColor( &Color( 0, 64, 127 ) );
$tFrame->setPaletteForegroundColor( &Color( 255, 255, 255 ) );
$tFrame->setFixedHeight( 100 );
my $myLabel = Qt::Label( "Welcome to Ark Linux", $tFrame );
$myLabel->setGeometry( Qt::Rect( 300, 0, 600, 90 ) );
$myLabel->setFont( Qt::Font( "Bitstream Vera Sans", 24, &Qt::Font::Bold ) );
$myLabel->setAlignment( &AlignCenter );
}
sub midFrame {
my $mainWidgetStack = Qt::WidgetStack( this, 0 );
my $introPage = Qt::Widget( $mainWidgetStack, 0 );
my $introPageLayout = Qt::VBoxLayout( $introPage, 11, 6, 0);
my $welcomeTextLabel = Qt::Label( $introPage, 0 );
$introPageLayout->addWidget( $welcomeTextLabel );
my $spacer1 = Qt::SpacerItem( 1500, 20, Qt::SizePolicy::Expanding(), Qt::SizePolicy::Minimum() );
$introPageLayout->addItem( $spacer1 );
my $spacer2 = Qt::SpacerItem( 20, 800, Qt::SizePolicy::Minimum(), Qt::SizePolicy::Expanding() );
$introPageLayout->addItem( $spacer2 );
my $string = "<font size=2>Now that you have installed Ark Linux, please spend a few moments to
configure your computer.<p>
If you have any questions about an option, feel free to click the help button below
and then click on the item while the cursor looks like a question mark to view it's
inline help.</font>";
$welcomeTextLabel->setText( $string );
$welcomeTextLabel->setFont( Qt::Font( "Bitstream Vera Sans", 14, &Qt::Font::Normal ) );
$mainWidgetStack->addWidget( $introPage, 0 );
my $accountsSetupPage = Qt::Widget( $mainWidgetStack, 0 );
my $accountsSetupPageLayout = Qt::VBoxLayout( $accountsSetupPage, 11, 6, 0 );
my $step1String = Qt::Label( $accountsSetupPage, 0 );
$step1String->setText( "<font size=\+4>Step 1:</font>" );
# $accountsSetupPage->addWidget( $step1String );
}
sub btmFrame {
my $backIcon = Qt::Pixmap( "/usr/share/icons/crystalsvg/32x32/actions/back.png" );
my $helpIcon = Qt::Pixmap( "/usr/share/icons/crystalsvg/32x32/actions/help.png" );
my $exitIcon = Qt::Pixmap( "/usr/share/icons/crystalsvg/32x32/actions/stop.png" );
my $nextIcon = Qt::Pixmap( "/usr/share/icons/crystalsvg/32x32/actions/forward.png" );
my $line1 = Qt::Frame( this, 0 );
$line1->setGeometry( Qt::Rect( 0, 700, 1024, 20 ) );
$line1->setFrameShape( Qt::Frame::HLine() );
$line1->setFrameShadow( Qt::Frame::Sunken() );
my $privLayWidget = Qt::Widget( this, "bLayMan" );
$privLayWidget->setGeometry( Qt::Rect( 10, 720, 1000, 42 ) );
my $bLayMan = Qt::HBoxLayout( $privLayWidget, 11, 6, "layout2");
my $backBttn = Qt::PushButton( $privLayWidget, 0 );
$backBttn->setFlat( 1 );
$backBttn->setPixmap( $backIcon );
$backBttn->setPaletteBackgroundColor( &Color( 97, 148, 216 ) );
$bLayMan->addWidget( $backBttn );
my $b_Spacer = Qt::SpacerItem( 750, 20, &Qt::SizePolicy::Expanding, &Qt::SizePolicy::Minimum );
$bLayMan->addItem( $b_Spacer );
my $helpBttn = Qt::PushButton( $privLayWidget, 0 );
$helpBttn->setFlat( 1 );
$helpBttn->setPixmap( $helpIcon );
$helpBttn->setPaletteBackgroundColor( &Color( 97, 148, 216 ) );
$bLayMan->addWidget( $helpBttn );
my $line2 = Qt::Frame( $privLayWidget, 0 );
$line2->setFrameShape( Qt::Frame::VLine() );
$line2->setFrameShadow( Qt::Frame::Sunken() );
$bLayMan->addWidget( $line2 );
my $exitBttn = Qt::PushButton( $privLayWidget, 0 );
$exitBttn->setFlat( 1 );
$exitBttn->setPixmap( $exitIcon );
$exitBttn->setPaletteBackgroundColor( &Color( 97, 148, 216 ) );
$bLayMan->addWidget( $exitBttn );
$exitBttn->connect( $exitBttn, SIGNAL 'pressed()', Qt::app(), SLOT 'quit()' );
my $nextBttn = Qt::PushButton( $privLayWidget, 0 );
$nextBttn->setFlat( 1 );
$nextBttn->setPixmap( $nextIcon );
$nextBttn->setPaletteBackgroundColor( &Color( 97, 148, 216 ) );
$bLayMan->addWidget( $nextBttn );
$nextBttn->connect( $nextBttn, SIGNAL 'pressed()', $wdgt::midFrame, SLOT 'raiseWidget( aboutToShow() )' );
}
1;
package main;
use Qt;
use strict;
use mainWidget;
my $app = Qt::Application(\@ARGV);
my $wdgt = mainWidget;
Qt::Object::connect( $app, SIGNAL( "lastWindowClosed()" ), $app, SLOT( "quit()" ) );
$app->setName( "AFTWiZard" );
$app->setMainWidget( $wdgt );
$wdgt->showFullScreen();
$wdgt->show();
$app->exec();
exit 0;
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBBoDazpYIGqyXDl5wRAgNEAKDOwCctGnT2cSnSv6h0O+A1cZNApwCaA8mL 3eWlF6Kc5fWr2LqX4h2CG3M= =XYhm -----END PGP SIGNATURE-----