Reputation: 16121
I have a QListView which I can fit to contents by calling updateGeometry. Now I want to animate it. I cant use the resizeEvent, since it is calles after the widget has been resized. What is the proper place to start this animation, ergo which members are called internally?
Upvotes: 0
Views: 175
Reputation: 1006
Well, you should leave the QListView quite and focus instead on its model. Let's say that you have something like:
QListView *myListView;
In that case you should pay attention to its model, which means:
QAbstractItemModel *myListModel(myListView->model());
You can connect some slot (depending on when you want to start the animation, before or after the data is being fetched by the views), maybe something like:
connect(myListModel, &QAbstractItemModel::rowsAboutToBeInserted, myHandlingObject, &MyHandlingObjectClass::myHandlingSlot);
or:
connect(myListModel, &QAbstractItemModel::rowsInserted, myHandlingObject, &MyHandlingObjectClass::myHandlingSlot);
Inside MyHandlingObjectClass::myHandlingSlot() slot you will eventually start a QPropertyAnimation. I think it's not much more than this. Hope it helps!
Upvotes: 1