sorry, finally I think I understand your problem. I think what I suggested above might not work as you want.
{
// Q_OBJECt etc
public:
MyMapper(int id) : id_(id) {}
public slots:
{
//...
resultLookup(info, id_);
deleteLater(); // this object no longer needed?
}
private:
int id_;
};
void YourMethod()
{
int streamId = ...;
MyMapper* mapper = new MyMapper(streamId);
}
class MyMapper : QObject
{
// Q_OBJECt etc
public:
MyMapper(int id) : id_(id) {}
public slots:
void myResultLookup(QHostInfo info)
{
//...
resultLookup(info, id_);
deleteLater(); // this object no longer needed?
}
private:
int id_;
};
void YourMethod()
{
int streamId = ...;
QString hostname = ...;
MyMapper* mapper = new MyMapper(streamId);
QHostInfo::lookupHost(hostname, mapper, SLOT(myResultLookup(QHostInfo)));
}
To copy to clipboard, switch view to plain text mode
Bookmarks