I wouldn't call .doc or .pdf file a text file. They're binary formats and QTextBrowser won't handle them. You could try to embed ActiveX controls in your application to display non-HTML files.
What does ui.datalineEdit->text() contain? You are supposed to pass HTML code to QTextBrowser::setHtml(). Maybe you wanted to use QTextBrowser::setSource() instead?
It is possible, but you have to use Active Qt or some 3rd party library.
Bookmarks