[Qt-interest] Need to show a dialog on click of QLabel
Keshava Krishna
keshavkrishna88 at gmail.com
Thu May 14 13:53:35 CEST 2009
Kamakshi here is your class
class yourLabel : public QLabel
{
Q_OBJECT
public:
yourLbel(QWidget *parent):QLabel(parent)
{}
public slots:
void dummy(){}
signals:
void clicked();
protected:
void mousePressClickEvent ( QMouseEvent* e)
{
emit clicked();
}
};
now, u have got your customized class...
just use it...
yourLabel *newLabel = new yourLabel();
connect(newLabel,SIGNAL(clicked()),this,SLOT(showDialog()));
assuming that showDialog() will show wateber dialog u want....
hope it helped you...
On Thu, May 14, 2009 at 4:35 PM, Arnold Krille <arnold at arnoldarts.de> wrote:
> On Thursday 14 May 2009 11:25:40 Kamakshi Sivaraman wrote:
> > I need to show a dialog on click of QLabel.
> > Please tell, how can I do that.
>
> Use a button instead of a label. Something clickable is a button, something
> just for display of text and/or graphic is a label. For the sake of
> userfriendlieness keep it that way. Otherwise you can't expect your users
> to
> know that they should click the label. Unless you want them to click on all
> labels and complain that for most of them nothing happens...
>
> Arnold
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
Regards,
Keshava.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090514/f8a97266/attachment.html
More information about the Qt-interest-old
mailing list