Hi friends,

I have a class that must pass as a parameter in the constructor pointer to a class that inherits from any QWidget. I'm trying to use the concept of templates for this, but I'm having difficulties. When compiling, I have the following error:

undefined reference to `Report: Report (QWidget *, NFePrint *)

The following snippet of code in classes involved:

Qt Code:
  1. class Report: public QMainWindow
  2. {
  3. Q_OBJECT
  4. public:
  5. template <typename Tx>
  6. Report(QWidget *parent = 0, Tx *widgetPrint = 0);
  7. .....
  8. }
  9.  
  10. template <typename Tx>
  11. Report::Report(QWidget *parent, Tx *widgetPrint)
  12. :QMainWindow(parent), currentZoom(100)
  13. {
  14. ui.setupUi(this);
  15. .......
  16. }
  17.  
  18. void MainWindow::showReport()
  19. {
  20. NFePrint *nfePrint = new NFePrint;
  21. Report *r = new Report(this, nfePrint);
  22. r->show();
  23. }
To copy to clipboard, switch view to plain text mode 

Thanks,

Marcelo E. Geyer