PyQt4 QTextEdit:HTML表格中的垂直文本

问题描述 投票:1回答:1

我在PyQt4 / examples / demos中找到了一个名为Textedit的例子,它从HTML文件中创建文档,我将它用于表格报告,如MS Access报告。一切正常,但我不能垂直在HTML表格中设置文本。我正在尝试这段代码:

<html>
<head>
<title>QTextEdit Demonstration</title>

<style type="text/css">
p.vertical{
writing-mode:tb-rl;
filter:flipH flipV;
height:60px;
</style>
</head>

<body>
<table align="center" border="1" cellpadding="4" cellspacing="0" width="99%">
<tr>
<td><p class = "vertical"><span>vertical</span></p></td>
<td><p><span>horizontal</span></p></td>
<td><p><span>0</span></p></td></tr>
</table></body></html>

在浏览器中它工作正常,但是当我在Textedit中打开它时,它没有。还有另一种在TextEdit中垂直设置文本的方法吗?

html python-2.7 pyqt4
1个回答
0
投票

QTextEdit仅支持属性的子集,请参阅此处了解支持的属性:

http://doc.qt.io/archives/qt-4.8/richtext-html-subset.html

我建议QTextDocument使用defaultStyleSheet属性:

http://doc.qt.io/archives/qt-4.8/qtextdocument.html#defaultStyleSheet-prop
© www.soinside.com 2019 - 2024. All rights reserved.