[Qt-interest] Implement click event on QLabel

Girish Ramakrishnan girish at forwardbias.in
Tue Dec 7 19:06:11 CET 2010


Hi,

On Tue, Dec 7, 2010 at 9:38 PM,  <Oliver.Knoll at comit.ch> wrote:
> 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! ;)
>

Signals and slots are normalized - the const and references are
dropped. This means that both SIGNAL(linkClicked(QString)) and
SIGNAL(linkClicked(const QString &)) will work just fine. In fact, the
former is faster and is the convention you will find in Qt's own code.

The bug in the OP code is that he seems to have missed the SLOT macro.
I wonder how the code even compiles by just putting close_event() as
the slot argument.

Girish



More information about the Qt-interest-old mailing list