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. VerticalHeaderView/TableView required properties go all over the place when using syncView

VerticalHeaderView/TableView required properties go all over the place when using syncView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 153 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.
  • R Offline
    R Offline
    romain.donze
    wrote on 13 Jul 2023, 13:56 last edited by romain.donze
    #1

    I have recently switched from Qt 5.15 to Qt 6.5 and doing so, I had to use the Quick.Controls 2 TableView.

    When trying to do this kind of thing:

    TableView {
        id: tableView
        anchors.fill: parent
    
        leftMargin: checkColumn.width
        clip: true
    
        model: TableModel {
            TableModelColumn { display: "name" }
            rows: [ { "name": "Harry" }, { "name": "Hedwig" } , ...]
        }
    
        selectionModel: ItemSelectionModel {
            model: tableView.model
        }
    
        delegate: Rectangle {
            implicitWidth: 100
            implicitHeight: 30
            color: selected ? "blue" : "lightgray"
    
            required property bool selected
    
            Text { text: display }
        }
    }
    
    VerticalHeaderView {
        id: checkColumn
        parent: tableView
        syncView: tableView
        selectionModel: tableView.selectionModel
        boundsBehavior: tableView.boundsBehavior
        delegate: CheckBox {
            required property int row
            required property bool selected
    
            onRowChanged: console.log("onRowChanged", row, selected)
            onSelectedChanged: console.log("onSelectedChanged", row, selected)
            checked: selected
            onToggled: tableView.selectionModel.select(tableView.model.index(row, 0), ItemSelectionModel.Toggle | ItemSelectionModel.Rows)
        }
    }
    

    I realised that the "required property int row" in the checkbox is reupdated on every item loaded in the header as soon as 1 item is flicked outside the view, and required property bool selected changes to false without even emiting any signals (I can see it through the checkbox that is unselected) though there is selected indexes in the ItemSelectionModel. But this does not appens int the main TableView.

    I have already create a BUG for this (https://bugreports.qt.io/browse/QTBUG-115227)

    1 Reply Last reply
    0

    1/1

    13 Jul 2023, 13:56

    • Login

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