--- Gary Greene <greeneg@xxxxxxxxxxxxx> wrote:
>
> I'm trying to get the selected QIconViewItem from a QIconView in a
> PerlQt app
> I'm working on and I can't seem to connect the SIGNAL to SLOT for it.
> Here's
> a snippet of code from the app:
>
> $drives[ $i ] = Qt::IconViewItem( $MainWidget::driveView,
> &tr(
> "$driveName\n$roundedSize GB" ),
> $drvIcon );
> $MainWidget::driveView->connect( $MainWidget::driveView,
> SIGNAL "clicked( $driveView->currentItem() )",
> this,
> SLOT "&driveSelected()" );
> }
well, you can't do SIGNAL "foo($variable)" since $variable can't be
interpreted at connect() time. Also, I don't think the "&" in
"&driveSelected()" is legal.
So, here's what you could do instead:
$driveView->connect(SIGNAL "clicked()", this, SLOT "driveSelected()");
In the driveSelected() slot, if you want to find out the current item,
you can call this->sender->currentItem(), or you could use your global
$MainWidget::driveView->currentItem(). Personally, I'd use
this->sender.
Ashley Winters
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|