6
我试图实现显示/隐藏部件动画。该小部件是一个QDockWidget,因此在QMainWindowLayout中。Qt显示/隐藏部件动画
使用QPropertyAnimation好好尝试似乎工作,我得到的东西看起来就像是:
m_listViewDock->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QPropertyAnimation* animation = new QPropertyAnimation(m_listViewDock, "geometry", m_listViewDock);
animation->setDuration(1000);
QRect g = m_listViewDock->geometry();
animation->setStartState(g);
g.setHeight(80);
animation->setEndState(g);
animation->start(QAbstractAnimation::DeleteWhenStopped);
遗憾的是它没有做任何事情。我尝试过其他属性(minimumHeight,fixedHeight),但同样的问题。
我以为我没有使用设计器正确设置我的小部件布局,但即使我用最小尺寸玩,我仍然没有任何结果。如果我想玩尺寸,应该使用什么样的尺寸策略?
我被卡住了,如果有人能够澄清我的问题,那将会非常棒。我不知道我做错了什么......在您的帮助, 鲍里斯
谢谢 -