Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
4.2.2
-
None
Description
Some type libraries use interface inheritance, and when calling APIs that return a generic "Item" object that actually is a "MailItem" it is a bit difficult to actually then call MailItem APIs, as the QAxObject wrapperclass generated does not reflect the interface inheritance (it can't, as ActiveQt creates an "Item" instance anyway based on what the IDL specifies).
Right now, solving this problem requires the creation of a new MailItem object that wraps the same IDispatch* as the existing Item object:
IDispatch *disp;
item->queryInterface(IID_IDispatch, (void**)&disp);
MailItem *newItem = new MailItem(disp, item->parent()); // Releases the IDispatch!
This could be simplified by having dumpcpp generate a static function in MailItem
static MailItem *fromItem(Item *item);
that does the above. One such function for each super-interface in the type library would then also "document" the hierarchy correctly and avoid mistakes.