Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] changing image using keypress
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] changing image using keypress

Scheduled Pinned Locked Moved General and Desktop
28 Posts 3 Posters 7.9k 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
    #21

    i tried . but still getting error

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

    Sasi

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

    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #22

      What errors ?

      Be Cute

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sasireka
        wrote on last edited by
        #23

        Good day.
        [quote author="IamSumit" date="1412164041"]What errors ?[/quote]

        @void Dialog::ShowPicture(QString path)
        {
        QMovie *movie = new QMovie(path);
        QLabel *processLabel = new QLabel(this);
        ui->processLabel->setMovie(movie);
        movie->start();

                    ui->label1->setText(QString::fromUtf8("chennai  சென்னை"));
                    ui->label1->show();
        

        }

        void Dialog::keyPressEvent(QKeyEvent *e)
        {

        if(e->key() == Qt::Key_F3)
        {
                ShowPicture(/home/dev6/Desktop/animation/2.gif);
        }
        

        }@

        errors:

        1. /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:70: error: invalid suffix "gif" on floating constant

        2. * /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:-1: In member function 'void Dialog::ShowPicture(QString)':
        1
        <* /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:70: error: expected primary-expression before '/' token

        2< /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:70: error: 'home' was not declared in this scope

        3< /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:70: error: 'home' was not declared in this scope

        4< /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:70: error: 'Desktop' was not declared in this scope

        5< /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:70: error: 'animation' was not declared in this scope

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

        Sasi

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

        1 Reply Last reply
        0
        • IamSumitI Offline
          IamSumitI Offline
          IamSumit
          wrote on last edited by
          #24

          Hi.
          You are not passing a string .string always encloses " " quotes.
          @
          19.ShowPicture(/home/dev6/Desktop/animation/2.gif);
          @
          Correct it as .
          ShowPicture("/home/dev6/Desktop/animation/2.gif");

          Be Cute

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sasireka
            wrote on last edited by
            #25

            [quote author="IamSumit" date="1412585094"]Hi.
            You are not passing a string .string always encloses " " quotes.
            @
            19.ShowPicture(/home/dev6/Desktop/animation/2.gif);
            @
            Correct it as .
            ShowPicture("/home/dev6/Desktop/animation/2.gif");
            [/quote]

            yes.. really i am so sorry.Thanks alot. great help.

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

            Sasi

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

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sasireka
              wrote on last edited by
              #26

              Thanks alot IamSumit IamSumit and all.

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

              Sasi

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

              1 Reply Last reply
              0
              • IamSumitI Offline
                IamSumitI Offline
                IamSumit
                wrote on last edited by
                #27

                That's ok .

                Now please Make your thread title as [SOLVED] so others could notify that solution has been found.:)

                Be Cute

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sasireka
                  wrote on last edited by
                  #28

                  [quote author="IamSumit" date="1412587771"]That's ok .

                  Now please Make your thread title as [SOLVED] so others could notify that solution has been found.:)[/quote]

                  yes.. done IamSumit. :)

                  Happy Coding :)

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

                  Sasi

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

                  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