I have a problem again and I would be greteful to everybody who could help me.

I have a fucntion in a class that I want to use in another without having to rewrite it again. Th eidea is to open a text document from and to work with it in different windows.

May I explain a bit?
1- In First class.cpp (line 13), I am geting the document I want to work with.
2- In second class.cpp (line 10), I retrieve the resulat of the operation and save in list.

My code is just not compiling, and I am suspecting the argument in second class.cpp (line 10) to be wrong, but I have reach my limit at this point.

Any help would be welcome.

Many thanks in advance!

Here is my code:

First class.h

Qt Code:
  1. #ifndef DEF_HERITAGE
  2. #define DEF_HERITAGE
  3.  
  4. #include <QtGui>
  5.  
  6.  
  7. class Heritage: public QMainWindow
  8. {
  9. Q_OBJECT
  10.  
  11. public:
  12. explicit Heritage(QWidget *parent = 0);
  13. virtual ~Heritage();
  14.  
  15. public slots:
  16. void operation1(QTextDocument &doc);
  17.  
  18. private:
  19. QLineEdit *m_openFile;
  20.  
  21.  
  22.  
  23. };
To copy to clipboard, switch view to plain text mode 

First class.cpp
Qt Code:
  1. #include "Heritage.h"
  2. #include "ChildWindow.h"
  3.  
  4. Heritage::Heritage(QWidget *parent)
  5. {
  6. m_openFile = new QLineEdit;
  7. setWindowTitle("Heritage");
  8. setCentralWidget(centralWidget);
  9. }
  10.  
  11. void Heritage::operation1(QTextDocument &doc)
  12. {
  13. QFile file1(m_openFile->text());
  14. ....
  15. }
To copy to clipboard, switch view to plain text mode 

Second class.h
Qt Code:
  1. #ifndef DEF_CHILDWINDOW
  2. #define DEF_CHILDWINDOW
  3.  
  4. #include<QtGui>
  5. #include"Heritage"
  6.  
  7. class ChildWindow: public QWidget
  8. {
  9. Q_OBJECT
  10.  
  11. public:
  12. explicit ChildWindow(QWidget *parent = 0);
  13. virtual ~ChildWindow();
  14.  
  15. public slots:
  16. void operation2(Heritage &aFile, QStringList &list);
  17.  
  18. private:
  19.  
  20. };
  21.  
  22. #endif // CHILDWINDOW_H
To copy to clipboard, switch view to plain text mode 

Second class.cpp
Qt Code:
  1. #include "ChildWindow.h"
  2. #include "Heritage.h"
  3.  
  4. ChildWindow::ChildWindow(QWidget *parent)
  5. : QWidget(parent)
  6. {
  7. }
  8. void ChildWindow::operation2(Heritage &aFile, QStringList &list)
  9. {
  10. list = aFile.operation1(m_openFile->document());
  11. }
  12.  
  13.  
  14. ChildWindow::~ChildWindow()
  15. {
  16. ;
  17. }
To copy to clipboard, switch view to plain text mode