Qt 使用 C++11 lambda 实现 connect
QByteArray page = ...;
QTcpSocket *socket = new QTcpSocket;
socket->connectToHost("qt-project.org", 80);
QObject::connect(socket, &QTcpSocket::connected, this, [=] () {
socket->write("GET " + page + "\r\n");
}, Qt::AutoConnection);
//重载
connect(buttonGroup, static_cast<void(QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked),
[=](QAbstractButton *button){ /* ... */ });
// overloaded
connect(buttonGroup, static_cast<void(QButtonGroup::*)(int/*参数*/)>(&QButtonGroup::buttonClicked),
[=](int id){ /* ... */ });