Changing image by using keypress



  • hi all,

    Good day. I want to change the image using keypress. If i am pressing F2, in screen i have to show first image. Again pressing F2 second time in screen have to show next image. please give me some IDEA and SIMPLE EXAMPLE to do it.

    Thanks & Regards
    Sasi



  • i added this code in dialog.cpp
    while pressing "enter" it not showing that image.

    @
    bool Dialog::eventFilter(QObject *obj, QEvent *event)
    {
    if(event->type() == QEvent::KeyPress)
    {
    QKeyEvent *key = static_cast<QKeyEvent *>(event);

        if((key->key() == Qt::Key_Enter)) //|| (key->key() == Qt::Key_Return))
        {
                QMovie *movie = new QMovie("/home/dev6/Desktop/animation/spectrum.gif");
                QLabel *processLabel = new QLabel(this);
                ui->processLabel->setMovie(movie);
                movie->start();
        }
    
    }
    

    }@


  • Lifetime Qt Champion

    Like already suggested don't create multiple copies of the same questions

    Closing this one

    "Duplicate":http://qt-project.org/forums/viewthread/47975/


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.