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
Qt 6.11 is out! See what's new in the release blog

Changing image by using keypress

Scheduled Pinned Locked Moved India
3 Posts 2 Posters 3.0k Views 1 Watching
  • 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 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 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
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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

        • Login

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