I am trying to implement a GUI having some push buttons & a window to display image.
There are two buttons Start & Stop
When the start button is pushed, a sequence of images stored in an array of QString has to be displayed.
When Start button is pushed, new_dialog() Slot is called.
The code for new_dialog() is as follows:
void Custom_window::new_dialog()
{
list[0] = "/home/suresh/Desktop/Test/gui_client/newflower.png";
list[1] = "/home/suresh/Desktop/Test/gui_client/mod_xfce-in-the-moon.png";
list[2] = "/home/suresh/Examples/logo-Kubuntu.png";
list[3] = "/usr/share/xfce4/backdrops/xfce-smoke.png";
list[4] = "/usr/share/xfce4/backdrops/xubuntu-steel.png";
for(int i=0;i<5;++i)
{
p= p.scaled( old_window->width(), old_window->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
old_window->resize(500,480);
old_window->setPixmap(p);
timer->start(5000);
connect(timer, SIGNAL(timeout()),old_window , SLOT(setPixmap(p)));
}
}
void Custom_window::new_dialog()
{
list[0] = "/home/suresh/Desktop/Test/gui_client/newflower.png";
list[1] = "/home/suresh/Desktop/Test/gui_client/mod_xfce-in-the-moon.png";
list[2] = "/home/suresh/Examples/logo-Kubuntu.png";
list[3] = "/usr/share/xfce4/backdrops/xfce-smoke.png";
list[4] = "/usr/share/xfce4/backdrops/xubuntu-steel.png";
for(int i=0;i<5;++i)
{
QTimer *timer = new QTimer;
QPixmap p(list[i]);
p= p.scaled( old_window->width(), old_window->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
old_window->resize(500,480);
old_window->setPixmap(p);
timer->start(5000);
connect(timer, SIGNAL(timeout()),old_window , SLOT(setPixmap(p)));
}
}
To copy to clipboard, switch view to plain text mode
The problem I was facing is that I was able to display only the last frame.
And the error I am facing is
Object::connect: No such slot QLabel::setPixmap(p)
But I was able to see the last image.
Bookmarks