<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt"><FONT
face=Arial>Hi everyone,<BR><BR>in my script I have a table view showing one
column and few rows (one or two) in which each cell contains lots of data. When
the data in the cells is too big it cannot be displayed in the table area, so I
expect that a vertical scrollbar comes in, but this does not happen. Here is a
piece of code showing the problem:<BR><BR></FONT>
<DIV class=bbcode_container>
<DIV class=bbcode_description><FONT face=Arial>from PyQt4.QtCore import
*<BR>from PyQt4.QtGui import *<BR><BR>class TableModel(QAbstractItemModel)
:<BR> def rowCount(self,
index):<BR> return
1<BR><BR> def columnCount(self,
index):<BR> return
1<BR><BR> def data(self, index, role)
:<BR> i, j = index.row(),
index.column()<BR> if role ==
Qt.DisplayRole
:<BR> return
'\n'.join(["data %d"%i for i in range(1000)])<BR><BR> def
index(self, row, col, parent=QModelIndex())
:<BR> return self.createIndex(row,
col, 0)<BR><BR> <BR>class
Table(QTableView) :<BR> def __init__(self, model)
:<BR>
QTableView.__init__(self)<BR><BR>
self.setModel(model)<BR>
self.setSelectionBehavior(QAbstractItemView.SelectRows)<BR>
#self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)<BR> <BR>class
Frame(QWidget) :<BR> def __init__(self, parent, model=None)
:<BR> super(QWidget,
self).__init__(parent)<BR>
<BR> self.table =
Table(TableModel())<BR>
<BR> vbox =
QVBoxLayout()<BR>
vbox.setContentsMargins(0, 0, 0,
0)<BR>
vbox.addWidget(self.table)<BR>
self.setLayout(vbox)<BR>
self.table.resizeRowsToContents()<BR> <BR>if __name__ ==
"__main__" :<BR> import sys<BR> a =
QApplication(sys.argv)<BR> <BR> dia =
Frame(None)<BR> dia.resize(400, 400)<BR>
dia.show()<BR> a.exec_()</FONT></DIV>
<DIV class=bbcode_description> </DIV></DIV><FONT
face="Times New Roman"><FONT face=Arial>If you run this code you'll see that
even if the content of the cell exceeds the table area, the scrollbar is not
displayed...am I missing something?<BR>Thanks in advance for your help!</FONT>
</FONT></DIV></DIV></BODY></HTML>