PDA

View Full Version : URI in QTextBrowser - how to specify a directory as a target for external link?



bjdodo
1st November 2009, 20:28
Hello

I have qt 4.5.2 on kubuntu 9.10. I am trying to display a link in a QTextBrowser that points to a directory.

This is my code:

// setOpenExternalLinks(true); is called
//resultDir contains /tmp/a/, an existing directory

QString sFinalTxt;
sFinalTxt = QString(TR("File(s) have been saved %1here%2")).
arg("<A HREF=\"file://" + resultDir + "/\">").arg("</a>");
m_textbrowser->append(sFinalTxt + "\n");


The text "here" does show as if it was a link but when I click it the QTextBrowser instance goes crazy, all text disappears, and in the console I can see

QTextBrowser: No document for file file:///tmp/a/

Does anyone know what I am doing wrong?

Thank you!

Jozsi