Width of ListView is -1
pbouda last edited by
I am using a ListView element to display some (complex) linguistics data with PyQt. The model consists of an array of hashes, of which values are itself hashes or arrays (I know this sounds complicated, but I need to represent my data somehow :-)). Now, I managed to get everything displayed as expected, but noticed that I can only scroll vertically. I then tried to add scrollbars (this one: https://bitbucket.org/gregschlom/qmlscrollbar/src/tip/ScrollBar.qml), but could only get the horizontal scrollbar working.
I played around A LOT, and found that my ListView has a contentWidth of -1. Somehow QML seems not to be able to calculate the width of my complex items. I tried to calculate item width by hand in every possible way, but this didn't work. I am totally stuck now, the application is more or less done, but without scrollbars it's useless. I also tried the scrollbars from qt-components, but they don't want to show at all (I also tried Row instead of ListView, and every possible combination of ListView and Rows/Columns).
Here is the main QML:
Here is the Utterance QML, which paints the second part of the item column in the delegate, a list of utterances:
I know this is hard to understand without running example... But did anyone have similar problems when using a ListView, that width or height are missing?