MS Windows上的QTextDocument中的可点击href

时间:2018-01-08 16:16:37

标签: qt odt qtextdocument

我正在努力解决Qt的奇怪行为( 5.3.1 - 不幸的是我无法使用更新版本),在以编程方式创建 odt 文件时,我能够通过执行以下操作添加href:

QTextDocument* l_doc = new QTextDocument();
QTextCursor l_cursor(l_doc);

QTextCharFormat l_tc_fmt;
l_tc_fmt.setAnchor(true);
l_tc_fmt.setAnchorHref("www.stackoverflow.com");
l_tc_fmt.setForeground(QApplication::palette().color(QPalette::Link));
l_tc_fmt.setFontUnderline(true);

l_cursor.setCharFormat(l_tc_fmt);
l_cursor.insertText("stackoverflow");

QTextDocumentWriter l_twd("/home/test.odt");
l_twd.setFormat("odf");
l_twd.write(l_doc);

导致包含可点击字符串的odt文档(在openoffice和msoffice上都有效):

enter image description here

我的问题是这只适用于Linux平台,而在Windows上我得到相同的下划线,蓝色字符串它无法点击(无论是在openoffice还是在msoffice中)。

将QTextDocument导出为html,我能看到的唯一区别如下:

  • 视窗 enter image description here
  • Linux的 enter image description here

有没有人在MS Windows上遇到过同样的问题?

0 个答案:

没有答案