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. ScrollView: scroll bars wrongly appear though content is smaller
Forum Updated to NodeBB v4.3 + New Features

ScrollView: scroll bars wrongly appear though content is smaller

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 474 Views 1 Watching
  • 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.
  • Q Offline
    Q Offline
    Quteroid
    wrote on last edited by
    #1

    I have a ScrollView with contents that entirely fit inside the ScrollView. For instance:

    ScrollView { x: 20; y: 20; width: 120 + 4; height: 90 + 4;
        Rectangle { x: 0; y: 0; width: 120; height: 90; color: "green" } }
    

    Typically, scroll bars should appear only if the content exceeds width or height of the ScrollVIew. However, here the ScrollView opens with both horizontal and vertical scroll bars visible. Even though the content is smaller than the ScrollView contents area. Only if I replace the "+ 4" with something like "+ 24" (>= width of scroll bars), so that the ScrollView gets notably bigger than its contents, the scroll bars disappear. The scroll bars also disappear if I bind the dimensions of the ScrollView to a window and resize it manually.

    Main question: is scroll bar's initial appearance in this scenario just a bug in Qt 5.3 or is there a clean way to hide them programmatically (unless content dimensions really exceed container's dimensions)?

    Note: if above's snipplet doesn't show scroll bars on your machine then this may be a platform-specific bug of Qt. I use Qt 5.3 on X11 and haven't checked other platforms yet. Please let me know if your result differs.

    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