Unsolved QPropertyAnimation and "visible"
-
Hello
in qml it is possible to animate the items visible property. I'm trying the same thing in c++ and it doesn't seem to be working. Is this a known issue or am I missing something. The reason for the attempt is that I'm setting up a number of parallel and sequential animations and during some of these steps I need to set visible false on certain items (not opacity 0). Using Qt 4.8.6
thanks
-
Hi,
Can you show how you do it currently ?
-
This was just a little test code. Missed that I was using NumberAnimation in the qml.
Transition {from: "State1"; to: "State2"; SequentialAnimation { ParallelAnimation { NumberAnimation { target: wnd1; property: "x"; from: 0; to: root.width; duration: 250 } NumberAnimation { target: wnd2; property: "x"; from: -root.width; to: 0; duration: 250 } } NumberAnimation { target: wnd1 ; property: "visible"; from: 1; to: 0; duration: 0 } }
Is there an easy solution to this, or will I have to derive my own from http://doc.qt.io/qt-4.8/qvariantanimation.html#details
Thanks
-
Did you check with the PropertyAnimation ?
-
Yes Qpropertyanimation is what I'm trying in c++, but it does not work. Note This needs to be done in c++ and not qml. The qml code i posted does work. It's the c++ equivalent that doesn't
kind regards
-
Then sorry I somehow misunderstood what you are trying to do.
What do you want to animate exactly in C++ ?
-
It's a menu system that slides in and out.
A given qml file contains several sub pages (each one is an Item). The c++ component keeps track of pages that should be shown based on available hardware and access levels and ordering. To minimise work required in qml we want to have as much as possible in the c++ component, including animations, to allow for easy "drop-in" of the component.
Thanks
-
Sounds like you are trying to split a bit too much the responsibilities. If you have the same animation for all your pages, why not have a base page that contains it and all the other be subclass of that base page.