So? What is the problem?
Qt Code:
  1. struct WidgetInterface{
  2. virtual QWidget *create(QWidget *parent)=0;
  3. // ...
  4. }
  5. struct ListViewInterface{
  6. virtual QListView *create(QWidget *parent)=0;
  7. // ...
  8. }
To copy to clipboard, switch view to plain text mode 

Or even use only WidgetInterface and check the widgets classname using Qt's meta data access and cast it to its proper class.