Animating new items in TableView

I use TableViewto display the contents of a SQLite database. The user clicks one of the validation buttons, and the right table is read through the API LocalStorage. Thus, the model is always new.

Since the model is always new, loading a new table is not visually appealing (all records are displayed immediately).

My idea was to animate the height of the line when it was added (in a linear fashion from 0)

Can this be done without overriding rowDelegatefrom scratch?

+4
source share
2 answers

Yes it is possible.

TableView ListView . , __listView.

ListView , , .

Transition {
    id: populateTransition
    NumberAnimation { properties: "y"; duration: 300 }
}

TableView {
    TableViewColumn {
        role: "title"
        title: "Title"
        width: 100
    }
    model: libraryModel
    Component.onCompleted: {
        this.__listView.populate = populateTransition
        this.__listView.add = populateTransition
    }
}

P.S. Qt .

+3

.

. , - ( QML):

  • .
  • - , .

, , , , NumberAnimation, , .

TableView ListView, .

0

Source: https://habr.com/ru/post/1607871/


All Articles