eka*_*pek 5 python checkbox pyqt alignment qtreeview
我有一个QTableView带复选框,但复选框左对齐,我需要将其居中对齐。我试过这个,但“检查”功能有问题:
def drawCheck(self, painter, option, rect, state):
textMargin = QtGui.QApplication.style().pixelMetric(QtGui.QStyle.PM_FocusFrameHMargin) + 1
checkRect = QtGui.QStyle.alignedRect(option.direction, QtCore.Qt.AlignCenter,
check(option, option.rect, QtCore.Qt.Checked).size(),
QtCore.QRect(option.rect.x() + textMargin, option.rect.y(),
option.rect.width() - (textMargin * 2), option.rect.height()))
QtGui.QItemDelegate.drawCheck(self, painter, checkRect, state)
Run Code Online (Sandbox Code Playgroud)
什么是“检查”功能?如何在 PyQt 中重新实现 C++ 示例?
| 归档时间: |
|
| 查看次数: |
970 次 |
| 最近记录: |