[PyKDE] PyQt4 Segmentation Fault - QTableView

Chris Dunscombe cdunscombe at yahoo.com
Tue Sep 19 16:44:32 BST 2006


Hi,

I now have a simple script to demo the seg fault:

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class mainWindow(QMainWindow):
    def __init__(self, parent = None):
        QMainWindow.__init__(self, parent)
        self.centralWidget = QWidget()
        self.setCentralWidget(self.centralWidget)

        model = QStandardItemModel(4, 2)
        tableView = QTableView()
        tableView.setModel(model)

        for row in range(4):
            for column in range(2):
                index = model.index(row, column, QModelIndex())
                model.setData(index,QVariant("Text"))
        txtWidget1 = QTextEdit()
        txtWidget2 = QTextEdit()
        tabWidget = QTableWidget(2,2)
        vLayout = QVBoxLayout()
        vLayout.addWidget(txtWidget1)
        vLayout.addWidget(txtWidget2)
        vLayout.addWidget(tabWidget)
        vLayout.addWidget(tableView)
        self.centralWidget.setLayout(vLayout)

app = QApplication(sys.argv)
mw = mainWindow()
mw.show()
app.exec_()


This seg faults when you click in the QTableView, bottom of the window, also it doesn't properly
display the table. As you can see from the code it works fine with a QTableWidget.

The issue I have in my app is a fair bit more complicated but essentially it all seems to revolve
around displaying a QTableView within a layout  etc in a QMainWindow.

Thanks,

Chris



--- Phil Thompson <phil at riverbankcomputing.co.uk> wrote:

> On Friday 15 September 2006 4:03 pm, Chris Dunscombe wrote:
> > Hi,
> >
> > I currently porting a working app from PyQt3 - PyQt4.
> >
> > I get a segmentation fault after the window.show() but before app.exec_()
> > in the initialisation script. The main window starts to appear and then
> > crashes with a segmentation fault. Any ideas on how to start finding the
> > root cause of the problem.
> >
> > Versions:
> >
> > PyQt 4.01
> > Qt 4.1.4
> > Python 2.4
> 
> The usual approach - instrument the code with debug statements, simplify the 
> code until the crash doesn't happen. If you can get to a simple script that 
> demonstrates the problem then post it here.
> 
> Phil
> 
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the PyQt mailing list