[PyQt] Possible display bug with editable QTreeWidgetItem on Linux

David Boddie david at boddie.org.uk
Tue Sep 9 20:07:55 BST 2014


On Tue, 09 Sep 2014 10:02:26 +0200, Vincent Michel wrote:

> I noticed a strange display bug when I ran a code using an editable
> QTreeItemWidget on a Linux machine (this doesn't happen on Windows).
> 
> While editing the widget, the previous value is still visible and messes
> up with the new value that is being typed.

Does the problem only occur with the native style? Which style is the
native one on your system? Can you try it with another one by passing
the -style option on the command line, like this example?

  python your_program.py -style cleanlooks

You need to change your code to ensure that the command line arguments
are processed by Qt:

    import sys
    from PyQt4 import QtCore, QtGui
    app = QtGui.QApplication(sys.argv)
    widget = QtGui.QTreeWidget()
    item = QtGui.QTreeWidgetItem(widget, ['x'*8])
    item.setFlags(QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled)
    widget.show()
    app.exec_()

David


More information about the PyQt mailing list