Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. India
  4. Changing image by using keypress
Forum Update on Monday, May 27th 2025

Changing image by using keypress

Scheduled Pinned Locked Moved India
3 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sasireka
    wrote on 30 Sept 2014, 04:43 last edited by
    #1

    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

    .................................
    Thanks & Regards

    Sasi

    .................................
    Go Green

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sasireka
      wrote on 30 Sept 2014, 06:25 last edited by
      #2

      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();
          }
      
      }
      

      }@

      .................................
      Thanks & Regards

      Sasi

      .................................
      Go Green

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 30 Sept 2014, 06:59 last edited by
        #3

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

        Closing this one

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        3/3

        30 Sept 2014, 06:59

        • Login

        • Login or register to search.
        3 out of 3
        • First post
          3/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved