Created
July 18, 2013 13:55
-
-
Save kissgyorgy/6029499 to your computer and use it in GitHub Desktop.
PyQt: Read only centered cells in QTableWidget.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt4.QtGui import QTableWidgetItem | |
from PyQt4.QtCore import Qt | |
class TableWidgetCenteredItem(QTableWidgetItem): | |
""" Read only centered cells in QTableWidget. """ | |
def __init__(self, *args, **kwargs): | |
super(TableWidgetCenteredItem, self).__init__(*args, **kwargs) | |
self.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) | |
self.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment