Below is my code. The first column wraps, but the third column doesn't, and shows ....<br><br>What am I doing wrong? I would like both columns to wrap.<br><br>TIA,<br>Kerri<br><br>__________________________<br>from PyQt4.QtGui
import *<br>from PyQt4.QtCore import *<br>import sys<br><br>class notesView(QTableView):<br><br> def __init__(self,parent, notes):<br> QTableView.__init__(self,parent)<br> self.setSizePolicy(QSizePolicy.Preferred
,<br> QSizePolicy.Fixed)<br><br> v = self.verticalHeader()<br> v.hide()<br><br> self.model = notesModel(notes)<br> self.setWordWrap(True)<br> self.resizeRowsToContents()<br>
self.resizeColumnsToContents()<br> self.setModel(self.model)<br><br>class notesModel(QAbstractTableModel):<br> <br> def __init__(self, notes):<br> QAbstractTableModel.__init__(self)<br> self.notes
= notes<br><br> def flags(self,index):<br> if not index.isValid():<br> return Qt.ItemIsEnabled<br> return Qt.ItemFlags(QAbstractTableModel.flags(self,index))<br><br> def rowCount(self, index=QModelIndex()):
<br> return len(self.notes)<br><br> def columnCount(self,index=QModelIndex()):<br> return 3<br><br> def headerData(self,section,orientation,role=Qt.DisplayRole):<br> if role == Qt.TextAlignmentRole
:<br> if orientation == Qt.Horizontal:<br> return QVariant(int(Qt.AlignHCenter|Qt.AlignVCenter))<br> return QVariant(int(Qt.AlignRight|Qt.AlignVCenter))<br> if role != Qt.DisplayRole
:<br> return QVariant()<br> if orientation == Qt.Horizontal:<br> if section == 0:<br> return QVariant('Date')<br> elif section == 1:<br> return QVariant('Author')
<br> elif section == 2:<br> return QVariant('Note')<br> return QVariant(int(section+1))<br><br> def data(self,index,role=Qt.DisplayRole):<br> if not index.isValid() or not (0 <=
index.row() < len(self.notes)):<br> return QVariant()<br><br> note = self.notes[index.row()]<br> column = index.column()<br><br> if role == Qt.DisplayRole:<br> if column == 0:
<br> return QVariant(QString(note['stamp']))<br> elif column == 1:<br> return QVariant(QString("%1, %2").arg(note['last_name'],note['first_name']))
<br> elif column == 2:<br> return QVariant(QString(note['note']))<br> elif role == Qt.TextAlignmentRole:<br> return QVariant(int(Qt.AlignLeft|Qt.AlignVCenter))<br><br> return QVariant()
<br><br>if __name__ == '__main__':<br><br> app = QApplication(sys.argv)<br> form = QDialog()<br> notes_list = [{'id':1,<br> 'stamp': '1/3/2008 4:31:04 PM',<br> 'last_name':'Blow',
<br> 'first_name':'Joe', <br> 'note':'This is a test of the emergency broadcast system. This is only a test.'}]<br> notes = notesView(form, notes_list)<br> notes.setMinimumWidth
(400)<br> notes.setMinimumHeight(200)<br> form.show()<br> app.exec_()<br>_____________________________<br clear="all"><br>-- <br>Yuma Educational Computer Consortium<br>Compass Development Team<br>Kerri Reno<br><a href="mailto:kreno@yumaed.org">
kreno@yumaed.org</a> (928) 502-4240<br>.·:*¨¨*:·. .·:*¨¨*:·. .·:*¨¨*:·.