PDA

View Full Version : Some questions about QT animation?



tszzp
21st October 2009, 08:46
I'm a freshman for QT, and I like it very much. Now I have some questions about QT, Hope you can give me some advice. thanks.

1) How to do a opacity animation for Widget, I notice the widget's property windowsOpacity, but it is all apply for the top-level window, not
for the child widget. and I notice that there is a new animation framework(QtPropertyAnimation), but I still haven't find how to do a opacity animation for child widget
using it. Can you give me some advice? or where I can find the simple sample for it? thanks.

2) In Windows platform, If use WPF(Windows Presentation Foundation), the designer and developer use the same XAML file, so they can collaborate with a seamless mode.
What's the collaborate mode in QT between with designer and developer? Such as control style, control template and so on. thanks.

wysota
21st October 2009, 09:50
1) How to do a opacity animation for Widget, I notice the widget's property windowsOpacity, but it is all apply for the top-level window, not
for the child widget. and I notice that there is a new animation framework(QtPropertyAnimation), but I still haven't find how to do a opacity animation for child widget
using it. Can you give me some advice? or where I can find the simple sample for it? thanks.
Without subclassing it won't be possible. You have to subclass each widget and introduce the opacity there. Alternatively with Qt 4.6+ you can use the new QGraphicsEffect class that you can apply on graphics items and widgets. It copes well with the animation framework you mentioned.


2) In Windows platform, If use WPF(Windows Presentation Foundation), the designer and developer use the same XAML file, so they can collaborate with a seamless mode.
What's the collaborate mode in QT between with designer and developer? Such as control style, control template and so on. thanks.

Currently we have stylesheets and Qt Designer for collaboration between des and dev. Later on (probably since Qt 4.7) we'll also have the so called "Declarative UI" (QML) language.

tszzp
26th October 2009, 03:25
wysota,thank you for your reply. I still have some problems about it.
1) subclass each widget and introduce the opacity there, can you give me more explain or give me a simple sample? thanks. and I think if subclass each widget and introduce the opacity, it is a big task to develop if need do opacity animation for many widget. if have the simple method to do it like WPF.
2) Where I can find the QGraphicsEffect sample to do graphic item or widget's opacity animation?
thanks again.

wysota
26th October 2009, 09:29
1) subclass each widget and introduce the opacity there, can you give me more explain or give me a simple sample? thanks.
You need to call QPainter::setOpacity() for every first non-opaque widget in the hierarchy. Opacity is propagated so you don't need to do it for its children.


and I think if subclass each widget and introduce the opacity, it is a big task to develop if need do opacity animation for many widget.
Yes, that's true.


if have the simple method to do it like WPF.
You can put everything into QGraphicsView and handle it there with one call but obviously this won't work for top-level widgets.


2) Where I can find the QGraphicsEffect sample to do graphic item or widget's opacity animation?
In Qt 4.6 docs.

tszzp
28th October 2009, 04:01
Thank wysota, I already know how to do the opacity animation by subclass each widget and introduce the opacity there. but I still can't find the QGraphicsEffect in my document and source code of qtanimationframework-2.3-opensource. the qtanimationframework-2.3-opensource is download from http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Utilities/qtanimationframework, the real link is ftp://ftp.trolltech.com/qt/solutions/lgpl/qtanimationframework-2.3-opensource.zip.

As I know, the qt4.6 isn't release now, it is only beta version. So my questions are as below:
1) now I use the qt version is qt 2009.03 open source version, I integrate it with VS2008, and compile the animation framework 2.3 opensource code, but I can't find the QGraphicsEffect in the document and source code of animation framework 2.3 opensource. so if I can find the new animation framework code to support the QGraphicEffect? If can, can you give me the link for download.

2) If I download the qt4.6 beta version, Can I integrate it in VS2008, not MinGW in Windows platform? now I try the opensource version,not the commercial version.

3) If use the QGraphicEffect to do widget's opacity animation, Is it write the less code than using the subclass each widget and introduce the opacity?

thank you very much.

aamer4yu
28th October 2009, 07:23
2) If I download the qt4.6 beta version, Can I integrate it in VS2008, not MinGW in Windows platform? now I try the opensource version,not the commercial version.

I guess you can :)

I am using 4.6.0-beta1 with Visual Studio 2005. I had built Qt with VS 2005. I dont have Qt designer integrated into Visual Studio, but I guess thers some add in for that. But basic things I can do easily.
To install Qt -
1) Download Qt source code.
2) Open Visual Studio command prompt in the extracted folder and run configure.exe -platform msvc-2008 ( chk the proper name with configure.exe -help)
3) follow the steps and finally after configure is done, u will need to run nmake

Thats to build Qt

To make project -
1) qmake -project
2) qmake -tp vc // will generate .vcproj
3) open the .vcproj in Visual studio

hope this helps :)

tszzp
28th October 2009, 09:05
thanks you for your reply. I want to know if there is QGraphicsEffect in qt4.6 beta 1. thanks.

wysota
28th October 2009, 10:20
but I still can't find the QGraphicsEffect in my document and source code of qtanimationframework-2.3-opensource.
Probably because it's not there. It's not part of the animation framework.


If can, can you give me the link for download.
Again, it's not part of the animation framework so obviously you won't find it there.


2) If I download the qt4.6 beta version, Can I integrate it in VS2008, not MinGW in Windows platform?
Yes.


3) If use the QGraphicEffect to do widget's opacity animation, Is it write the less code than using the subclass each widget and introduce the opacity?
I'd say so. It's two lines of code against at least 6 lines of code.