Results 1 to 14 of 14

Thread: how to add .giff or .avi files in app

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2007
    Posts
    69
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X
    Thanks
    14

    Question how to add .giff or .avi files in app

    hi all
    i am working on Qt4.1 using Mac OsX Platform
    i want to know how the support of .giff and .avi files are given to app


    thanks in advance

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: how to add .giff or .avi files in app

    GIF is supported through a plugin, but it is not automatically compiled because of patent issues.
    If you have the commercial edition, the you have it, otherwise if you did not select it when you compiled Qt you will have to reconfigure and recompile.

    AVI is not supported by Qt.

    Regards

  3. The following user says thank you to marcel for this useful post:

    thomasjoy (1st August 2007)

  4. #3
    Join Date
    Mar 2007
    Posts
    69
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X
    Thanks
    14

    Default Re: how to add .giff or .avi files in app

    does QT 4.1 support any other moving files like giff or avi???
    if any please do mention

    thaks in advance

  5. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: how to add .giff or .avi files in app

    Maybe you can do something with the QMovie class.
    It is used to display GIF animations.

    As I said before, AVI is not supported in Qt. But there are third party libraries out there which you can integrate.


    Regards

  6. The following user says thank you to marcel for this useful post:

    thomasjoy (1st August 2007)

  7. #5
    Join Date
    Mar 2007
    Posts
    69
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X
    Thanks
    14

    Default Re: how to add .giff or .avi files in app

    which types of format QMovie can support...??
    can you please list it down..

    if it support .gif then how ??
    can you tell me example code another than te QT manual code...means to say simple example where i am importing any .gif images i.e as i click to the .app directly .gif image start playing ..

    as i had try to create
    ------------
    form.cpp
    -----------
    #include <QMovie>

    void form:: imageStart()
    {

    movie = new QMovie("/background/mime-attachment.gif");
    label->setMovie(movie);
    movie->start();


    }
    ---------
    form.h
    ---------

    connect( movie,SIGNAL(started()),this,SLOT(imageStart()) );
    or is there any process or signal

    thanks in advance

  8. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: how to add .giff or .avi files in app

    First add a label to your window.

    Then use your existing movie code to attach it to that label.

    You can call movie->start() as a result of an action or a button click.
    For example if you have a button in your window, you can do the following:
    Qt Code:
    1. connect( button, SIGNAL(clicked()), movie, SLOT(start()));
    To copy to clipboard, switch view to plain text mode 
    But be careful to create the movie object before connecting.

    Pretty much this is it...


    Regards

  9. #7
    Join Date
    Mar 2007
    Posts
    69
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X
    Thanks
    14

    Default Re: how to add .giff or .avi files in app

    as i had try to use ur code like this
    everything i had placed in form.h
    but as i click button nothing happened

    see the .h

    class form :: public QDialog,private Ui::form
    {

    Q_OBJECT
    public:
    form::form(QWidget *parent): QDialog(parent)
    {
    setupUi(this);
    QMovie *movie = new QMovie("/background/mime-attachment.gif");
    label->setMovie(movie);
    movie->start();
    connect( pushButton,SIGNAL(clicked()),movie,SLOT(start()) );
    //QPixmap pixmap("/background/wizard-big-2.png");
    //label->setPixmap(pixmap);
    };


    thanks in advance







    };
    Last edited by thomasjoy; 1st August 2007 at 12:28.

  10. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: how to add .giff or .avi files in app

    Remove the line movie->start().
    The start() slot just starts the animation. You do this by pressing the button.

    Other than that, the code looks OK. Make sure that the path to the GIF is correct. Try giving the absolute file path, just to make sure it is loaded. It should work with your code.

    Regarding your question about other animation means in Qt:
    There is another one: The QSvgRenderer class. It supports animated SVGs. It is more advanced than the QMovie, since you basically can paint the svg on almost everything. Also , the SVG format overcomes many of the GIF drawbacks.

    To update the animation, the renderer provides the repaintNeeded() signal. This means that you need to render the svg again, since a new frame is available.


    Regards

  11. The following user says thank you to marcel for this useful post:

    thomasjoy (1st August 2007)

  12. #9
    Join Date
    Mar 2007
    Posts
    69
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X
    Thanks
    14

    Default Re: how to add .giff or .avi files in app

    if i dont have the -qt-gif support at time of configuration then what i have to do so that image should be moved as gif image move...

    and as manual saying gif support will be completly removed in upcomings of qt versions so is it benificial...?? if not then what i have to do???

    or what another way is,except QSvgRenderer class as it seems that these pictures made in gimpshop..

    is it possible that in every second like 1,2,3 .....after completion of every second image should be change ???
    like you can take an example when 1 second complete bulb image should be on,
    and after next second it should be off and next second again on ,then off-on,off-on
    ....so on till some process not completed((at starting it should be off)??

    if yes then tell me in simple example....

    thanks in advance

  13. #10
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: how to add .giff or .avi files in app

    if i dont have the -qt-gif support at time of configuration then what i have to do so that image should be moved as gif image move...
    You could recompile Qt with GIF support...

    or what another way is,except QSvgRenderer class as it seems that these pictures made in gimpshop..
    None built in.
    You can create svg's with many applications. A very good one is Inkscape and it is opensource.

    s it possible that in every second like 1,2,3 .....after completion of every second image should be change ???
    Yes, it is possible with a QSvgRenderer.
    Just prepare a svg and load it.
    Next call QSvgRender::setFramesPerSecond(1). This means a frame every second.
    So, every second you will get a repaint needed signal from the renderer, notifying you that a new frame is ready to be rendered.

    Regards

  14. The following user says thank you to marcel for this useful post:

    thomasjoy (1st August 2007)

  15. #11
    Join Date
    Mar 2007
    Posts
    69
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X
    Thanks
    14

    Default Re: how to add .giff or .avi files in app

    does QSvgRenderer only support svg files...if no then what kinds of images it support or
    list of supported image formats for this class??

    is it support .png if not then tell the same for .pngs

    s it possible that in every second like 1,2,3 .....after completion of every second image should be change ???
    like you can take an example when 1 second complete bulb image should be on,
    and after next second it should be off and next second again on ,then off-on,off-on
    ....so on till some process not completed((at starting it should be off)??
    thanks in advance

Similar Threads

  1. Replies: 5
    Last Post: 22nd September 2006, 08:04
  2. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 10:28

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.