PDA

View Full Version : tool tip for label



Seema Rao
21st April 2006, 13:04
Hi all,

Is it possible to add tool tip to a label? I tried to subclass QLabel , here is the code I had written,

#include <QLabel>

class QLabel;
class QMouseEvent;

class MutateLabel : public QLabel
{
Q_OBJECT
public:
MutateLabel( QString, QWidget * );

protected:

virtual void mousePressEvent( QMouseEvent * );

};
MutateLabel::MutateLabel( QString str, QWidget *parent )
: QLabel(str, parent )
{}

void MutateLabel::mousePressEvent( QMouseEvent *e )
{

}
I dont know how to proceed further. Can some body suggest some thing on this

Thanks in Advance,
Seema Rao

wysota
21st April 2006, 13:22
Why subclass?


QLabel *label = new QLabel("label", this);
label->setToolTip("Some tooltip");