[PyKDE] Is there a clicked signal for a QLabel ?

Krzysztof Lichota krzysiek at lichota.net
Wed Jan 31 10:15:07 GMT 2007


simon stockes napisał(a):
> Hi,
> 
> I have a gridlayout of QLabels. What it the signal to use in this
> context to change, for exemple, the text from the QLabel I have
> **clicked** ?
> 
> I did not found **clicked()** signal for QGridlayout or QLabel.

AFAIK you have to do it yourself.
Here is how I do it (in C++). pressed() is a new signal in ImageLabel
which inherits QLabel:

void ImageLabel::mouseReleaseEvent( QMouseEvent *e)
{
    if (e->button() != QMouseEvent::LeftButton)
    {
        QLabel::mouseReleaseEvent(e);
        return;
    }
    if (this->rect().contains(e->pos()))
    {
        emit pressed();
    }
}

HTH

	Krzysztof Lichota

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070131/81965d2c/signature.bin


More information about the PyQt mailing list