Either convert that document to a reference by using *(m_openFile->document()) or (better) declare the function to accept a pointer: operation1(QTextDocument *doc).