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. Enabling horizontal scroll in TableView (vs. ScrollView)
Forum Update on Monday, May 27th 2025

Enabling horizontal scroll in TableView (vs. ScrollView)

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.8k 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.
  • C Offline
    C Offline
    colby.white
    wrote on 21 Jun 2014, 01:40 last edited by
    #1

    I'm am trying to get a TableView to scroll horizontally. I've gotten the TableView to scroll vertically; that was fairly straightforward. But horizontally, when the columns are wider than the TableView, they are simply cut off as oppossed to be scrolled. The documentation for "TableView":http://doc.qt.digia.com/qt-5.2/qml-qtquick-controls-tableview.html indicates that one of the features of the class is to add scrollbars and even shows an image with the vertical, however it doesn't show a horizontal scroll bar (nor did I stumble across an example). I assume that the TableView is capable of it based on the doc and the fact that it inherits from "ScrollView":http://doc.qt.digia.com/qt-5.2/qml-qtquick-controls-scrollview.html.

    In debugging this, I stripped it down into the simplest case I could think of to reproduce this. I tested it right next to a ScrollView that successfully scrolls horizontally. Since TableView inherits from ScrollView, I'd assume that a similar construction would prompt horizontal scrolling, but no cigar. I assume I'm missing something small.

    Any thoughts why the following code scrolls for ScrollView but not TableView? I'm using "Qt 5.2":http://doc.qt.digia.com/qt-5.2/index.html.

    [CODE]import QtQuick 2.0
    import QtQuick.Controls 1.1

    Item {
    width: 500
    height: 500

    TableView{
        id: table
        model: 5
        width: 300
        height: parent.height/2
        headerVisible: false
        TableViewColumn{
            width: 700
            delegate: Text{
                // Hipster Ipsum
                text: "Pickled occupy stumptown bitters drinking vinegar. Viral scenester Tonx DIY, skateboard craft beer YOLO. Pinterest tote bag beard butcher Brooklyn asymmetrical. Mlkshk tote bag locavore viral, occupy typewriter craft beer meggings chia PBR&B pickled. Tousled flexitarian authentic raw denim scenester hashtag. Narwhal shabby chic sustainable, Tumblr Neutra kogi disrupt Vice chia McSweeney's distillery. Banjo artisan vegan food truck, salvia mumblecore leggings ennui mlkshk art party."
            }
        }
    }
    
    ScrollView{
        id: scroll
        frameVisible: true
        width: 300
        height: parent.height/2
        anchors.top: table.bottom
    
        Rectangle{
            height: scroll.height-17
            width: 700
            color: "yellow"
            border.color: "red"
    
            Text{
                // Hipster Ipsum
                text: "Pickled occupy stumptown bitters drinking vinegar. Viral scenester Tonx DIY, skateboard craft beer YOLO. Pinterest tote bag beard butcher Brooklyn asymmetrical. Mlkshk tote bag locavore viral, occupy typewriter craft beer meggings chia PBR&B pickled. Tousled flexitarian authentic raw denim scenester hashtag. Narwhal shabby chic sustainable, Tumblr Neutra kogi disrupt Vice chia McSweeney's distillery. Banjo artisan vegan food truck, salvia mumblecore leggings ennui mlkshk art party."
            }
        }
    }
    

    }
    [/CODE]

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on 23 Jun 2014, 10:21 last edited by
      #2

      This seems to have been caused by a valid issue that was recently fixed for 5.3.1 (or 5.2.1 if that is imminent):
      See https://bugreports.qt-project.org/browse/QTBUG-39393

      1 Reply Last reply
      0

      1/2

      21 Jun 2014, 01:40

      • Login

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