View Full Version : MainWindow animation -- sliding panel
Hi, I want to add sliding panel to my MainWindow, so I am trying to use the QPropertyAnimation;
animation = new QPropertyAnimation(ui->centralWidget, "geometry");
animation->setDuration(10000);
animation->setStartValue(QRect(0,0,356,330));
animation->setEndValue(QRect(0,0,450,330));
and activating it by a PushButton :
void MainWindow::buttonSlideClicked()
{
animation->start();
}
but it doesn't work. What I have to do to make it.
wysota
6th May 2013, 07:57
Please define what "doesn't work" means in this situation. Is ui->centralWidget part of a layout (if it's the central widget of a main window then it is)? Geometry of widgets that are managed by layouts cannot be controlled by the geometry property because the layout will override those values.
dosen't work means, that slideButton clicked dosen't slide the panel.
Yes, centralWidget is a MainWindow widget. If it cannot be controlled this way, how can I acces the geometry properties of this widget? I tried tu constract the animation with the MainWindow object (QMainWindow) but the compiler says, this is an invalid use of the MainWindow.
Thanks for answer, cheers
In a shortcut i want to make the MainWindow bigger on a clickButton.
wysota
6th May 2013, 08:09
You can put your panel inside the central widget of the main window (but don't make it part of a layout) and then animate it.
Well, I put a new widget inside the centralWidget. I ve got there one gridLayout and its outside of this. How can I ensure that it dosen't belong to any default layout? Becouse theres still no action by clicking my connected button;
I khnow it's a lot of question, but I am completly new in Qt, I'm reading still but theres a lot of information.
wysota
6th May 2013, 19:49
If you don't put it in a layout then it is not part of a layout. If animation doesn't work, it doesn't mean it has to be because of the layout.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.