Enabling horizontal scroll in TableView (vs. ScrollView)



  • 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]



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.