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. How to add line number for TableView?
Forum Updated to NodeBB v4.3 + New Features

How to add line number for TableView?

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

    Keep fixed when you want to drag horizontally

    import QtQuick 2.2
    import QtQuick.Layouts 1.1
    import QtQuick.Controls 1.2
    
    Item {
        id: root
        ListModel {
            id: libraryModel
            ListElement {
                title: "A Masterpiece"
                author: "Gabriel"
            }
            ListElement {
                title: "Brilliance"
                author: "Jens"
            }
            ListElement {
                title: "Outstanding"
                author: "Frederik"
            }
        }
        TableView {
            width: parent.width
            height: parent.height
            TableViewColumn {
                role: "title"
                title: "Title"
                width: 100
            }
            TableViewColumn {
                role: "author"
                title: "Author"
                width: 200
            }
            model: libraryModel
        }
    }
    

    Thanks!

    1 Reply Last reply
    0
    • MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by Markkyboy
      #2

      Related?;

      https://forum.qt.io/topic/115314/qtquick-2-tableview-row-number

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      S 1 Reply Last reply
      0
      • MarkkyboyM Markkyboy

        Related?;

        https://forum.qt.io/topic/115314/qtquick-2-tableview-row-number

        S Offline
        S Offline
        senmx
        wrote on last edited by
        #3

        @Markkyboy Thanks.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          senmx
          wrote on last edited by
          #4

          I encapsulated a vertical table header myself.

          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