Qt - QPropertyAnimation有一个错误? [英] Qt - There is a bug in QPropertyAnimation?

查看:262
本文介绍了Qt - QPropertyAnimation有一个错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面对一个非常严重的情况。通过写这个问题,我希望真正的专业人士将表达他们对我将要描述的问题的意见。我在 http://bugreports.qt.nokia.com/ 报告了一个错误:

I face a very serious situation. By writing this question I hope that really professionals will express their opinion regarding to the problem I am going to describe. I have reported a bug in http://bugreports.qt.nokia.com/ :


我已经为QTextEdit的maximumWidth属性创建了QPropertyAnimation,它不工作(它立即从开始状态改变状态到结束状态),虽然它工作用于minimumWidth属性。
请参阅附加的代码。

I have created QPropertyAnimation for maximumWidth property of QTextEdit and it does not work (it immediately changes state from starting state to the end state), though it works for minimumWidth property. Please see the attached code.

并附加了.h和.cpp文件。请查看此处(文件名为new.h和new.cpp)的文件。

And have attached .h and .cpp files. See those files here(files are named new.h and new.cpp).

我得到以下回应:


MaximumWidth不是属性想动画。它拥有窗口小部件可以具有的最大宽度,它与布局等相关。更改maximumWidth(以及minimumWidth)不一定会触发重新布局和重绘。

MaximumWidth is not the property you want to animate. It holds the maximum width that the widget can have, it's related to layouting and so on. Changing the maximumWidth (as well as the minimumWidth) does not necessarily trigger a relayout and repaint. You should animate the size.

请告诉我这是一个错误还是没有?请告诉我minimumWith属性是如何动画的,但是当它涉及maximumWidth属性,那么我不应该工作,这是OK?我只是不明白他们的观点...请解释。

Please explain me whether it is a bug or no? Please tell me how the minimumWith property is being animated but when it concerns to the maximumWidth property, then I should not work and that is OK? I just don't get their point... Please explain.

我写了这个代码,因为我想关闭动画的正确的QTextEdit,并确保当我调整主窗口,按钮和两个QTextEdit的地方,封闭的QTextEdit没有恢复。

P.S. I have written this code because I wanted to close by animation the right QTextEdit and be sure that when I resize the main window, where the button and two QTextEdit are, the closed QTextEdit does not being restored.

推荐答案

你检查了maximumWidth的实际值吗?你似乎没有在你的代码中设置一个具体的maximumWidth。

Did you check the actual value of maximumWidth? You don't seem to set a specific maximumWidth in your code.

maximumWidth的默认值为16777215,并且设置的持续时间为1毫秒。用于关闭动画。从16777215衰减到3毫秒。看起来像即时,我猜。

The default value for maximumWidth is 16777215, and you set a duration of 1 msec. for the closing animation. Fading from 16777215 to 3 in 1 msec. would look like "instant", I guess.

这篇关于Qt - QPropertyAnimation有一个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆