Hi Ed,

> Is the “[=]()” a place holder?
>
>
With Qt 5, you can now use functors and lambda functions for slots:
http://doc.qt.io/qt-5/qobject.html#connect-4.

If you are using a recent compiler which support C++11 standard, then you
should be able to use lambda functions.

Event2Signal *e2s = new Event2Signal(lineEdit);
e2s->filterEvent(lineEdit, QEvent::MouseButtonPress);
connect(e2s, &Event2Signal::filteredEvent,
[=](QObject *o, QEvent *e, bool *filtered) {
// Activate your form and do other things here..
});

Lambda functions have look like this [...](....) { .... }.

   - The square brackets allow you to capture one or more (or all)
   variables in the current stack. Typically we see usage of =. So when we use
   [=], we are saying that within the lambda function we would like to be able
   to access all variables accessible from the current stack. You could
   specify a list of variables also for example.
   - Within the round brackets, you will need to declare all parameters in
   the signal function.
   - Within the curly braces, you can write your slot code.

You can read up the StackOverflow question that Andy has posted for more
information about this.

Connecting to signals this way frees you from having to write slots in
QObject subclasses all the time.

Best Regards,
Prashanth
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to