[Kde-perl] Right Click Menu

Germain Garand germain at ebooksfrance.org
Sat Aug 30 22:45:58 CEST 2003


Le Samedi 30 Août 2003 19:51, Steffen Liebergeld a écrit :
> Am Sam, 2003-08-30 um 19.17 schrieb Richard Dale:

Hi Steffen,

> should it look like this?
>

nearly :)

> sub mousePressEvent{

this is a Qt::ListView, which has a special way of handling mouse events (see 
$QTDIR/bin/assistant), the correct virtual is named 
"contentsMousePressEvents"

You can monitor which virtuals are called with
  use Qt::debug "virtuals";
I recommend it, it's handy :)

>     shift->SUPER::NEW(@_);

this call does not make sense here: it is only used in NEW to process the  
SUPER constructor (the NEW of the Qt::ListView) before processing 
the rest of your constructor.

>     if ($_[0]->button() == "RightButton"){

it's right except that RightButton isn't a QString in Qt, but an enum value, 
which are accessed this way in PerlQt:
  &Qt::RightButton
or even &RightButton in this context (every Qt class isa Qt::)

> 	rightmenu->exec(Qt::Cursor.po());

and there it would be Qt::Cursor::pos()

Cheers,

Germain



More information about the Kde-perl mailing list