Skip to content

Instantly share code, notes, and snippets.

@azat
Created December 3, 2012 18:02
Show Gist options
  • Select an option

  • Save azat/4196751 to your computer and use it in GitHub Desktop.

Select an option

Save azat/4196751 to your computer and use it in GitHub Desktop.
lambda
/**
* 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