[PyKDE] QTreeWidget, Segmentation Fault
Carles Pina i Estany
carles at pina.cat
Sat Oct 28 22:40:00 BST 2006
Hi,
I an learning to use QTreeWidget, QTreeWidgetItem, etc. and I got a
segmentation fault. I think that because I am using some stupid thing,
so this mail is a report of how to crash pyqt and is a request to fix my
bad code :-)
I am doing:
self.model = QtGui.QStandardItemModel(8,3,self)
self.model.setHeaderData(0,QtCore.Qt.Horizontal, QtCore.QVariant(self.tr("Directori")))
self.model.setHeaderData(1, QtCore.Qt.Horizontal, QtCore.QVariant(self.tr("Suffix")))
self.model.setHeaderData(2, QtCore.Qt.Horizontal, QtCore.QVariant(self.tr("Offset")))
self.ui.merge_sources.setModel(self.model)
(merge_sources is type <widget class="QTreeWidget" name="merge_sources" > )
I have not had time to watch carefully QTreeWidget and QTreeView, etc. sorry -I
am sure that I am not using in the correct way
Then I have:
def on_merge_sources_itemDoubleClicked(self,item,column):
if column==0:
directori=QtGui.QFileDialog.getExistingDirectory(self,"Select a directory","Select a directory")
item.setText(0,"hola")
self.ui.merge_sources.setCurrentItem(item)
And here it crash. I just want that if user double clicks column 0 appears
a QFileDialog and set some text, nothing more. I think that I don't use
item variable in correct way.
The gdb report:
(gdb) bt
#0 0xb712bf47 in QTreeWidget::metaObject () from /usr/lib/libQtGui.so.4
#1 0x082f7ad8 in ?? ()
#2 0x0824fed0 in ?? ()
#3 0xbfb668e8 in ?? ()
#4 0xb7afd7f9 in QMetaObject::cast () from /usr/lib/libQtCore.so.4
#5 0xb7134fba in QTreeWidget::setCurrentItem () from /usr/lib/libQtGui.so.4
#6 0xb713500a in QTreeWidget::setCurrentItem () from /usr/lib/libQtGui.so.4
#7 0xb73e0c9b in ?? () from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#8 0x080b954b in PyEval_EvalFrame ()
#9 0x080ba6b5 in PyEval_EvalCodeEx ()
#10 0x08100669 in PyClassMethod_New ()
#11 0x08058987 in PyObject_Call ()
#12 0x0805e26e in PyClass_IsSubclass ()
#13 0x08058987 in PyObject_Call ()
#14 0x080b3bdd in PyEval_CallObjectWithKeywords ()
#15 0xb7ba1eb2 in sip_api_emit_to_slot ()
from /usr/lib/python2.4/site-packages/sip.so
#16 0xb7c01219 in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#17 0xb7c0159c in initQtCore ()
from /usr/lib/python2.4/site-packages/PyQt4/QtCore.so
#18 0xb7b0a235 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#19 0xb7b0ab9c in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#20 0xb712c2ca in QTreeWidget::itemDoubleClicked () from /usr/lib/libQtGui.so.4
#21 0xb7134daf in QTreeWidget::currentItem () from /usr/lib/libQtGui.so.4
#22 0xb71354df in QTreeWidget::qt_metacall () from /usr/lib/libQtGui.so.4
#23 0xb7b0a235 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#24 0xb7b0ab9c in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#25 0xb70c7a94 in QAbstractItemView::doubleClicked ()
from /usr/lib/libQtGui.so.4
#26 0xb70fe100 in QTreeView::mouseDoubleClickEvent ()
from /usr/lib/libQtGui.so.4
#27 0xb744451c in initQtGui ()
from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#28 0xb6d79037 in QWidget::event () from /usr/lib/libQtGui.so.4
#29 0xb6ff9a04 in QFrame::event () from /usr/lib/libQtGui.so.4
#30 0xb706dffc in QAbstractScrollArea::viewportEvent ()
from /usr/lib/libQtGui.so.4
#31 0xb70cb322 in QAbstractItemView::viewportEvent ()
from /usr/lib/libQtGui.so.4
#32 0xb7413223 in ?? () from /usr/lib/python2.4/site-packages/PyQt4/QtGui.so
#33 0xb706f715 in QAbstractScrollArea::setViewport ()
from /usr/lib/libQtGui.so.4
#34 0xb6d2f551 in QApplicationPrivate::notify_helper ()
from /usr/lib/libQtGui.so.4
#35 0xb6d32053 in QApplication::notify () from /usr/lib/libQtGui.so.4
#36 0xb7612673 in initQtGui ()
....
Using Debian with:
ii pyqt4-dev-tools 4.0.1-5 Development tools for PyQt4
ii python-qt4-dev 4.0.1-3 Development files for PyQt4
ii python-qtext 3.16-1.2 Qt extensions for PyQt
ii libqt4-core 4.2.0-1 Qt 4 core non-GUI functionality runtime libr
ii libqt4-dev 4.2.0-1 Qt 4 development files
ii libqt4-gui 4.2.0-1 Qt 4 core GUI functionality runtime library
ii libqt4-qt3support 4.2.0-1 Qt 3 compatibility library for Qt 4
ii libqt4-sql 4.2.0-1 Qt 4 SQL database module
ii pyqt4-dev-tools 4.0.1-5 Development tools for PyQt4
ii python-qt4 4.0.1-3 Python bindings for Qt4
ii python-qt4-dev 4.0.1-3 Development files for PyQt4
ii qt4-designer 4.1.4-1.1 Qt 4 Designer
ii qt4-dev-tools 4.2.0-1 Qt 4 development tools
ii qt4-doc 4.1.4-1.1 Qt 4 API documentation
ii python-qt4 4.0.1-3 Python bindings for Qt4
ii python 2.4.3-11 An interactive high-level object-oriented la
ii python-sip4 4.4.5-3 Python/C++ bindings generator runtime librar
If you need more information, tell me.
Maybe I should upgrade to new pyqt versions, I think that I have last
Debian ones.
I am sure that I am not using Qt in correct way. But, anyway, should not
crash in that way :-)
Thanks!
--
Carles Pina i Estany GPG id: 0x8CBDAE64
http://pinux.info Manresa - Barcelona
More information about the PyQt
mailing list