Am sorry Pankaj.Yes It worked now...
Now my problem was to use the same code in constructor of example w am not able to get animation.
if i use any of these lines in example.cpp it says
QPushButton button("Animated Button",&w); //error because of w
QPushButton button("Animated Button");//No error but button does not get displayed
QPushButton button("Animated Button",this);//No error but button does not get displayed
Code:
//MAIN
#include "example.h"
#include <QMainWindow>
#include <QPushButton>
#include <QPropertyAnimation>
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
example w;
w.show();
return a.exec();
}
Code:
//example.cpp
#include "example.h"
#include <qpushbutton.h>
#include <QtGui>
#include <QFrame>
#include <QWidget>
#include <QLabel>
#include <QDockWidget>
#include <QStatusbar>
#include <QToolButton>
#include <QPalette>
#include <QDesktopWidget>
#include <QtGui>
#include <QApplication>
example::example(QWidget *parent) :
QMainWindow(parent)
{
ui.setupUi(this);
QPushButton button("Animated Button", &w);
QPropertyAnimation animation(button, "geometry");
animation.setDuration(10000);
animation.setStartValue(QRect(0, 0, 100, 30));
animation.setEndValue(QRect(250, 250, 100, 30));
animation.start();
}
k::~k()
{
}
Can you help me here...
Chirpylife