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. ScrollBar in TableView
QtWS25 Last Chance

ScrollBar in TableView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 3.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.
  • M Offline
    M Offline
    MTOLANI
    wrote on last edited by ambershark
    #1

    Hi,

    I am trying to use a horizontal scroll bar inside tableview. Since tableview already comes with a scrollBar, I have used the code :

     TableView {
    
                id: tableView1
                width: 100
                height: 100
                anchors.fill: parent
                anchors.margins: 20
                horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOn
                flickableItem.flickableDirection : Flickable.HorizontalAndVerticalFlick
    }
    

    Using ScrollViewStyle as well :

    style: TableViewStyle {
    
                    ScrollViewStyle {
    
                        handle: Rectangle {
                            implicitWidth: 2
                            implicitHeight: 5
                            anchors.fill: parent
                             color: "red"
                        }
    
                        scrollBarBackground: Item {
                            implicitWidth: 2
                            implicitHeight: 5
                        }
    
    
                    }
    

    But this is how my scrollBar appears 0_1526325638652_ScrollBar.png

    I am not able to scroll horizontally. Is there anything I am missing out? I changed the width of the table, but it didn't work

    QtVersion : 5.9
    OS : Windows

    Thanks

    [@ambershark]: fixed formatting so image would appear.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      Hi. I don't actually see any items in your table. You won't be able to scroll unless you have something that goes outside the frame. You would need column headers or an item that actually caused the need to scroll horizontally in order for it to allow scrolling.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      1
      • M Offline
        M Offline
        MTOLANI
        wrote on last edited by
        #3

        Hi,

        Yes there is data. I dint show it up here. As you can see my scroll bar covers the entire table.
        The only way out is to increase the width of the last column to a point such that it shows scroll bar.
        How do i make the width customised in an editable tableview?
        Such that it increase, decreases according to data.

        A 1 Reply Last reply
        0
        • M MTOLANI

          Hi,

          Yes there is data. I dint show it up here. As you can see my scroll bar covers the entire table.
          The only way out is to increase the width of the last column to a point such that it shows scroll bar.
          How do i make the width customised in an editable tableview?
          Such that it increase, decreases according to data.

          A Offline
          A Offline
          ambershark
          wrote on last edited by
          #4

          @MTOLANI Sorry I don't quite understand what you want to do here...

          How do i make the width customised in an editable tableview?

          What width do you want customized?

          Such that it increase, decreases according to data.

          Does this mean you want a dynamically sized horizontal scroll bar based on window contents?

          If possible can you do a quick qml example that I can run to duplicate your problem? Maybe I can figure out what the issue is if I could actually see it and play with it.

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          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