为QListView的大小调整制作动画
Animate the resizing of a QListView
我有一个QListView,可以通过调用updateGeometry来适应内容。现在我想设置它的动画。我不能使用resizeEvent,因为它在小部件调整大小后被调用。开始这个动画的正确位置是什么,或者内部调用哪些成员?
好吧,您应该离开QListView,转而关注它的模型。假设你有这样的东西:
QListView *myListView;
在这种情况下,你应该注意它的模型,这意味着:
QAbstractItemModel *myListModel(myListView->model());
您可以连接一些插槽(取决于您想何时开始动画,在视图获取数据之前或之后),可能类似于:
connect(myListModel, &QAbstractItemModel::rowsAboutToBeInserted, myHandlingObject, &MyHandlingObjectClass::myHandlingSlot);
或:
connect(myListModel, &QAbstractItemModel::rowsInserted, myHandlingObject, &MyHandlingObjectClass::myHandlingSlot);
在MyHandlingObjectClass::myHandlingSlot()插槽中,您最终将启动QPropertyAnimation。我想这不算什么。希望它能有所帮助!
相关文章:
- 在执行其他功能的同时播放动画(LED矩阵和Arduino/ESP8266)
- 为char数组调整zlib-zpipe
- 调整大小后指向元素值的指针unordered_map有效?
- 在C++中调整向量中的索引
- 哪些库可以通过Opencv调整曝光率
- 使用 GLUT 使用键停止动画?
- 如何调整 std::vector of Eigen::MatrixXd 的大小
- Alt+Enter 在 Win32 应用中,管理大小调整和分辨率
- 在容量内调整矢量大小时的性能影响
- 使用对象数组对 SFML 进行动画处理
- 将 boost::odeint 与向量类一起使用,而无需调整向量的大小
- (SFML)按下键时,播放器构造函数未使用正确的动画进行更新
- 将摄像机调整到俯视图
- Qt 图表条形图调整大小崩溃
- 除非重新绘制大小,否则SDL_Texture在调整大小后呈现黑色
- 如何减慢从 BVH 文件读取的 opengl 动画?
- 调整布局上的 QGraphicsView 小部件的大小
- 如何在使用调整大小对话框的动画后固定QDialog的大小
- 为QListView的大小调整制作动画
- 使用图形魔术调整动画 GIF 的大小