Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved ScrollBar in TableView

    QML and Qt Quick
    2
    4
    2540
    Loading More Posts
    • 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
      MTOLANI last edited by ambershark

      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 Reply Quote 0
      • A
        ambershark last edited by

        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 Reply Quote 1
        • M
          MTOLANI last edited by

          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 Reply Quote 0
          • A
            ambershark @MTOLANI last edited by

            @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 Reply Quote 0
            • First post
              Last post