[PyQt] Possible bug or change in PyQt5.10.1, width changing when adding item to QTreeWidget
ferdnyc at gmail.com
Wed Jun 27 06:18:02 BST 2018
Florian Bruhin wrote:
> Seems fine with Qt 5.11. Probably this Qt bug:https://bugreports.qt.io/browse/QTBUG-65478
I'm not so sure about that, compiling and running the example project
attached to that bug didn't give me any problems (running under Qt 5.10.1
from Fedora 28 packages), but I definitely saw the issues with Thomas's
original script. Also, that bug is about manually-resized column widths
being reset on sort order changes, not columns growing wider with every
THOMAS EDVARDSEN wrote:
> I encountered an issue with PyQt 5.10.1, where if i have a QTreeWidget with sorting enabled, adding a QTreeWidgetItem causes the width to double. (Or at least increase)
> This only happens in PyQt 5.10.1. (Tested 5.9 and 5.10, where this does not happen). If i disable the sorting, it will not increase the width of the widget. I have not been able to install 5.11 because i can't load the site, nor is it on pypi yet, so i don't know if it's fixed in that version.
Huh, interesting. I ran your example code on Fedora with the
python-qt5-5.10-3.fc28 package installed, and I definitely saw the bug you
mentioned. First click, a horizontal scrollbar appeared, and then every
time I clicked an item, the list *widget* grew wider — even though the
width of the column itself was constrained to the window width. Resizing
the window resized the list, but there was still that extra area to the
right that didn't change size even as the window grew.
In fact, did you notice that every time you reverse the sort order of the
column, the width *also* grows? So it doesn't seem to be merely *adding*
items that widens the widget, it's any interaction or update.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt