Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-485

Generate static from-factory functions in dumcpp-generated code to simplify casting

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • Some future release
    • 4.2.2
    • ActiveX Support
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes