[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] Crash on exit using QCompleter for QComboBox
From: Jeremy Sanders <jeremy () jeremysanders ! net>
Date: 2014-06-01 9:30:02
Message-ID: 538AF29A.9060001 () jeremysanders ! net
[Download RAW message or body]
I wonder whether the following is a bug in my code or in PyQt. If you
try to use the completer for completing text, then exit, there is a
segfault in QWidgetPrivate::deleteTLSysExtra().
This goes away if the completer is removed and deleted before the
program exits (uncomment final two lines in main).
I assume this is some sort of ownership issue, but I've tried various
combinations of parents and so on, to no avail. I've worked around this
in my code by creating and removing the completer in showEvent() and
hideEvent(), but this is rather ugly.
This is PyQt4-4.10.2 and sip-4.14.7 on Linux.
Thanks
Jeremy
["test.py" (text/x-python)]
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class FullCompleter(QCompleter):
"""Complete based on substring."""
def __init__(self, parent, combo):
QCompleter.__init__(self, parent)
self.setCompletionMode(QCompleter.PopupCompletion)
self.proxymodel = QSortFilterProxyModel(self)
self.proxymodel.setSourceModel(combo.model())
self.setModel(self.proxymodel)
def splitPath(self, path):
self.proxymodel.setFilterRegExp(QRegExp(
path, Qt.CaseInsensitive,
QRegExp.FixedString))
return ['']
def main():
app = QApplication([])
combo = QComboBox()
combo.addItems(['hello', 'world', 'world hello', 'hello world'])
combo.setEditable(True)
combo.show()
completer = FullCompleter(combo, combo)
combo.setCompleter(completer)
app.exec_()
#combo.setCompleter(None)
#completer = None
if __name__ == '__main__':
main()
[Attachment #4 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic