Created
December 3, 2012 18:02
-
-
Save azat/4196751 to your computer and use it in GitHub Desktop.
lambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * QLambda wrapper for Qt connect | |
| * | |
| * File: lambda.cpp | |
| * Date: 4/15/2012 | |
| * | |
| * @link http://www.silmor.de/qtstuff.lambda.php | |
| * @link http://stackoverflow.com/questions/4731947/overloading-on-stdfunction | |
| * | |
| * @package ad-reger | |
| * @author Azat Khuzhin <a3at.mail@gmail.com> | |
| * | |
| * For the full copyright and license information, please view the LICENSE | |
| * file that was distributed with this source code. | |
| */ | |
| #include "qlambda.h" | |
| #include <QDebug> | |
| namespace Wrapper { | |
| QLambda::QLambda(lambdaCallback callback, QObject* parent) : QObject(parent), _callback(callback) { | |
| } | |
| void QLambda::call(QObject* qOb = NULL) { | |
| qDebug() << "Execute lambda function " << (void*)this << " with " << qOb; | |
| _callback(qOb); | |
| } | |
| void QLambda::call(QNetworkReply* qNetworkReply) { | |
| qDebug() << "Execute lambda function " << (void*)this << " with " << qNetworkReply; | |
| _callback(qobject_cast<QObject*>(qNetworkReply)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment