在Qt.AlignRight右对齐文本,但把它放到了右上角.这Qt.AlignRight | Qt.AlignVCenter不起作用.将它放入左上角.
有没有办法让文本保持垂直居中并同时右对齐?
代码示例:
from PySide.QtCore import *
from PySide.QtGui import *
class TableView(QTableView):
def __init__(self):
QTableView.__init__(self)
self.setModel(TableModel(self))
class TableModel(QAbstractTableModel):
def rowCount(self, parent):
return 1
def columnCount(self, parent):
return 2
def data(self, index, role):
if role == Qt.DisplayRole:
return 'text'
elif role == Qt.TextAlignmentRole:
return Qt.AlignRight | Qt.AlignVCenter
app = QApplication([])
w = TableView()
w.show()
app.exec_()
Run Code Online (Sandbox Code Playgroud)
我正在使用PySide 1.2.1和Qt 4.8.6.
| 归档时间: |
|
| 查看次数: |
1135 次 |
| 最近记录: |