Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I am new in Qt C++. I want to use a delegate feature as in Objective-C. How can I use such a thing?
brandont last edited by
See "Wikipedia":http://en.wikipedia.org/wiki/Delegation_pattern#Complex_C.2B.2B_example . Is that what you mean?
DenisKormalev last edited by
Don't know how ObjC implements delegation, but if we are speaking about OO delegation mechanism, then maybe you can do what you need with signal-slots mechanism?
I have IconDownloader class. it downloads image asyncranously and i want it to trigger owner class's method.
IconDownloader *iconDownloader = [[IconDownloader alloc] init];
iconDownloader.imageUrl = "http://www.a.com./image.jpg";
iconDownloader.delegate = self;
// called by our IconDownloader class when an icon is ready to be displayed
- (void)appImageDidLoad:(NSIndexPath *)indexPath
Franzk last edited by
Use "signals & slots":http://doc.trolltech.com/latest/signalsandslots.html as Denis proposed.
thanks for help :)
I understand now. we can declare our own signals. ok.