Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Width of ListView is -1
QtWS25 Last Chance

Width of ListView is -1

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pbouda
    wrote on last edited by
    #1

    Hi,

    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:

    http://pastebin.com/VDqcWrTS

    Here is the Utterance QML, which paints the second part of the item column in the delegate, a list of utterances:

    http://pastebin.com/DrCXzrYR

    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?

    Peter

    http://www.dasskript.com

    Peter

    http://www.peterbouda.eu

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved