Hi to all,
I'm reading the Animation Framework and I would try it in my application.
I would animate the position of a little dialog that I show pressing a button.
This is the code I tried:
// executed on the released() signal of a button
void WaveWidget::onShowInfoPanel()
{
if( !m_panel->isVisible() )
{
m_panel->setVisible(true);
QPropertyAnimation animation(m_panel, "geometry");
animation.setDuration(2000);
animation.
setStartValue(QRect(0,
0,
135,
240));
//just an example animation.
setEndValue(QRect(250,
250,
135,
240));
//just an example animation.start();
}
else
m_panel->setVisible(false);
}
// executed on the released() signal of a button
void WaveWidget::onShowInfoPanel()
{
if( !m_panel->isVisible() )
{
m_panel->setVisible(true);
QPropertyAnimation animation(m_panel, "geometry");
animation.setDuration(2000);
animation.setStartValue(QRect(0, 0, 135, 240));//just an example
animation.setEndValue(QRect(250, 250, 135, 240));//just an example
animation.start();
}
else
m_panel->setVisible(false);
}
To copy to clipboard, switch view to plain text mode
So I would give to the panel an animated effect but nothing happens when I show the panel. When I press the button the panes is shown without any special effect.
Is my code incorrect?
Regards
Bookmarks