[Qt-interest] Implement click event on QLabel
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Tue Dec 7 17:08:34 CET 2010
On 2010-12-07 Lucas Lucas P. Caixeta wrote:
> Hello!
>
> Guys, i need to implement a click event on a QLabel...
> i 'm trying:
> connect(ui->label_exit, SIGNAL(linkActivated(QString)), this ,close_event() );
Two things: do you REALLY want to quit/close the application/dialog when the user clicks upon a LINK / URL? A push button would be the expected GUI element...
But assuming you REALLY want the user to click on an URL to CLOSE the dialog (or even the application main window, depending on what 'this' refers to), then check again the Qt docs very carefully:
http://doc.trolltech.com/4.7/qlabel.html#signals
See the '&' in the argument list? ;) That means that a REFERENCE to a QString is passed along, NOT a QString! When you check the output (on stdout/err) I would strongly expect that you see a "No such slot" message! ;)
But again, I strongly suspect what you are really after is a http://doc.trolltech.com/4.7/qpushbutton.html ...
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list