signal clicked()

David Baron d_baron at 012.net.il
Sun Jan 18 08:34:49 CET 2009


On Saturday 17 January 2009 09:48:55 Toussis Manolis wrote:
> I want my plasma to react on left click on it.
> What signal/object should I connect to my slot?
> I tried MyApplet::clicked() , but there is no such signal...

I used a mouse click event, wrote my own implementation for that function. 
This is not the "qt" way but no suitable signals are provided. This is what I 
did (I am not saying this is a preferred way, simply had no other):

void MyApplet::mousePressEvent ( QGraphicsSceneMouseEvent *ev ) {
    if  ( signalsBlocked() ) {
        Plasma::Applet::mousePressEvent( ev );
        return;
    }

    if  ( ev->button() == Qt::LeftButton )
        proc_click();
    else
        Plasma::Applet::mousePressEvent( ev );
}

The first if (I believe) prevents the UI from exercising while the applet is 
being moved about.

Right-clicks are handled by the applet's methods, i.e. to place the 
context/config menu. There are also hover functions available. No signals.


More information about the Plasma-devel mailing list