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. Speed of gif
Forum Updated to NodeBB v4.3 + New Features

Speed of gif

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.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.
  • K Offline
    K Offline
    KillGabio
    wrote on last edited by
    #1

    Hi guys!

    This is a very simple question. I have a QLabel with a QMovie that reproduces a .gif... The thing is that I dont know how to show it smoothly, I mean the gif shows perfectly but its like "stucking". I tried increasing the speed but that doesnt change anything...here is my code:

    @ int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    LoadingWidget *loadwidg = new LoadingWidget ();
    loadwidg->show ();
    qApp->processEvents ();
    QApplication::setStyle (new IconSize ());
    QCoreApplication::addLibraryPath (".");
    MainWindow mainWin;
    ajustarPreferenciasVentanaPrincipal (&mainWin);
    //----------------------------------------------------------
    //-----------------CONTROLADOR------------------------------
    //----------------------------------------------------------
    //some not interesting code
    //----------------------------------------------------------
    //-----------------FIN CONTROLADOR--------------------------
    //----------------------------------------------------------
    if (handler >= 0 && aux ==0 && capacidad >0){
    mainWin.setHandler (handler);
    loadwidg->~LoadingWidget ();
    mainWin.show();
    return a.exec();
    }else{
    if (capacidad == 0){
    QMessageBox::critical (0, QString ("NO MORE REGISTERS TO STORE DATA"), QString ("No quedan más registros para guardar información fiscal\n\nNo se podrá realizar ninguna operación\nrelacionada con el controlador."), QMessageBox::Ok);
    }else QMessageBox::information (0, QString ("NO FISCAL PRINTER"),QString ("No se ha encontrado el controlador fiscal\nconectado, no se podrá facturar"));
    mainWin.setHandler (-1);
    mainWin.show ();
    loadwidg->~LoadingWidget ();
    return a.exec ();
    }
    }@

    Thank you all in advance... Maybe its my slow computer, maybe its something i cant change...BTW QSplash window does not work for me, its not a solution :P

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jake007
      wrote on last edited by
      #2

      Anything less than 40 ms should be okay.
      Otherwise, gifs are pretty slow, so it might be computer ;).
      Can you upload a test gif to see the result?


      Code is poetry

      1 Reply Last reply
      0
      • K Offline
        K Offline
        KillGabio
        wrote on last edited by
        #3

        http://postimage.org/image/e8qj234cx/

        thats the gif..I think it is more than 40ms...The thing is that I think that the load of the main is delaying the gif

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jake007
          wrote on last edited by
          #4

          Try creating a separate thread for doing all the loading, and in the main thread display only gif ( all in loadingWidget).
          Otherwise, the delay is exactly 40ms, and it runs smoothly if I open it normally.


          Code is poetry

          1 Reply Last reply
          0
          • K Offline
            K Offline
            KillGabio
            wrote on last edited by
            #5

            I`ll try that approach

            1 Reply Last reply
            0
            • K Offline
              K Offline
              KillGabio
              wrote on last edited by
              #6

              Hi i think im having some problems understanding how to use the threads to my benefit....

              I`ve changed my main like this:

              @#include <QtGui/QApplication>
              #include <QObject>
              #include "waitthread.h"
              #include "loadthread.h"

              int main(int argc, char *argv[])
              {
              QApplication a(argc, argv);
              QApplication::setStyle (new IconSize ());

              LoadThread * load_thread = new LoadThread ();
              WaitThread * wait_thread = new WaitThread ();
              
              QObject::connect (load_thread, SIGNAL(load_finished()), wait_thread, SLOT(loading_finished()));
              
              load_thread->start ();
              wait_thread->start ();
              
              return a.exec &#40;&#41;;
              

              }@

              the loadthread.cpp:

              @LoadThread::LoadThread()
              {
              mainWin = new MainWindow ();
              }

              void LoadThread::run (){
              //--------------------do some stuff
              emit load_finished ();
              mainWin->show ();
              }@

              And the waitThread.cpp
              @#include "waitthread.h"

              WaitThread::WaitThread()
              {
              loadwidg = new LoadingWidget ();
              loadwidg->show ();
              }

              void WaitThread::run (){
              }

              void WaitThread::loading_finished (){
              loadwidg->close ();
              delete loadwidg;
              this->terminate ();
              }
              @

              Somehow..the mainWin doesnt show and the loadingwidget neither

              --------EDIT
              My bad loadingWidget is shown.

              ----EDIT 2

              found my first mistake the mainWin must be shown in a different method otherwise the thread finishes when run finishes

              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