PDA

View Full Version : Inserting links in QTextDocument



deca5423
1st April 2010, 14:21
I can't seem to find anything on this anywhere, but it appears as though links are not supported QTextDocument writer when writing in odf.



QApplication a(argc, argv);

QTextDocument document;
QTextCursor cursor(&document);

cursor.insertHtml("<a href=\"http://google.com\">Link</a>");

QTextDocumentWriter writer("test.odf", "odf");
writer.write(&document);

QTextDocumentWriter writer2("test.html", "html");
writer2.write(&document);

return a.exec();


When I run this, the test.html has a link that you can click. In the odf file, however, the text is just formatted ( blue and underlined ) and not a true link. And ctrl+click does not do anything. Does this mean it's simply not supported? Or is there something I'm missing? Thank you.

deca5423
9th April 2010, 03:19
Nobody has tried this? I feel I must be doing something wrong as if this was a problem in odf it would be documented, but I can't seem to find any such documentation. I would really appreciate any insight, even if it's just "hey I tried the code and I have the same problem!". Thank you.