Results 1 to 10 of 10

Thread: jpeg viewer

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: jpeg viewer

    Quote Originally Posted by chap19150
    what should I use. e.g. an array of filenames etc.
    It depends. If those files are selected by the user, it will be easier for you if you could pass a list of file names to that class, but if images will be generated (or corrected) on the fly it will be easier to operate on QPixmaps. You can even consider splitting the implementation into two classes --- one that manages the slideshow and one that provides the data (actually you can have many providers that share a common interface).

    Quote Originally Posted by chap19150
    can you explain "connect QTimer to nextFrame()" to me
    You can make QTimer instance emit a timeout() signal with a given frequency and use this signal to advance to the next frame.

    Quote Originally Posted by chap19150
    can you dumb this down for me?
    You can do this:
    Qt Code:
    1. class SlideShowWidget : public QWidget
    2. {
    3. Q_OBJECT
    4. public:
    5. ...
    6. public slots:
    7. void start();
    8. void stop();
    9. ...
    10. };
    To copy to clipboard, switch view to plain text mode 
    or this:
    Qt Code:
    1. class SlideShow : public QObject
    2. {
    3. Q_OBJECT
    4. public:
    5. ...
    6. void setLabel( QLabel * label );
    7.  
    8. public slots:
    9. void start();
    10. void stop();
    11. ...
    12. };
    To copy to clipboard, switch view to plain text mode 
    SlideShowWidget is a widget that displays a slideshow, while SlideShow can display a slideshow on a given QLabel. There's not much difference between them, but it's up to you to decide which one will suit you better.

  2. #2
    Join Date
    May 2006
    Location
    Philadelphia, PA USA
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Question Re: jpeg viewer

    Thanks, I think I understand now, but I have just a couple of more questions.

    The file are not going to be selected by the user. I have three sets of files
    in three different directories to be viewed. I know how to get QPixmap to
    view one file, but how do I get it to show the sequence? I have the images
    numbered folder1/pic1.jpg... folder1/pic50.jpg.

    also,

    Quote Originally Posted by jacek
    SlideShowWidget is a widget that displays a slideshow, while SlideShow can display a slideshow on a given QLabel. There's not much difference between them, but it's up to you to decide which one will suit you better.
    Are you sure it make no difference even though i have 3 labels that have to iterate in unison?
    For example if I create a normal object, how is that implemented? Do I have to call
    setLabel() for each QLabel?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: jpeg viewer

    Quote Originally Posted by chap19150
    I know how to get QPixmap to view one file, but how do I get it to show the sequence?
    QPixmap holds only a single image, so you will have to create a pixmap for every file (the question is: when?).

    Quote Originally Posted by chap19150
    Are you sure it make no difference even though i have 3 labels that have to iterate in unison?
    You will have either one object that shows n slide shows or n objects (each showing a single slide show). IMO it will be easier to have many objects. There shouldn't be any problems with synchronization, because you can connect the same signal to many slots.

  4. The following user says thank you to jacek for this useful post:

    chap19150 (5th June 2006)

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: jpeg viewer

    I don't see it mentioned anywhere, so what the heck... You could use QMovie which already implements much of the functionality you desire. It could be needed to subclass it though, to handle a sequence of jpegs (but you should verify that first).

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: jpeg viewer

    Quote Originally Posted by wysota
    It could be needed to subclass it though, to handle a sequence of jpegs
    The problem is that you can't subclass QMovie, because it has no virtual methods.

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: jpeg viewer

    Quote Originally Posted by jacek
    The problem is that you can't subclass QMovie, because it has no virtual methods.
    Why not? You don't have to cast it to QMovie* to use it... Correct me if I'm wrong but I recall that virtual methods are only required if you want to call the subclass reimplementation from the superclass interface...

    Qt Code:
    1. QMovie *m = new MyMovie();
    2. m->start(); // will always call from QMovie
    3.  
    4. MyMovie *m = new MyMovie();
    5. m->start(); // will call from MyMovie
    To copy to clipboard, switch view to plain text mode 

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: jpeg viewer

    Quote Originally Posted by wysota
    Why not? You don't have to cast it to QMovie* to use it...
    But you will have to implement every method, so there is no benefit in using QMovie.
    Qt Code:
    1. #include <iostream>
    2.  
    3. class A
    4. {
    5. public:
    6. void foo() { bar(); }
    7. void bar() { std::cerr << "A::bar()" << std::endl; }
    8. };
    9.  
    10. class B : public A
    11. {
    12. public:
    13. void bar() { std::cerr << "B::bar()" << std::endl; }
    14. };
    15.  
    16. int main()
    17. {
    18. B b;
    19. b.foo();
    20. b.bar();
    21. return 0;
    22. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Jpeg not support~
    By denny.t in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2006, 09:29
  2. Image Viewer
    By sumsin in forum Qt Programming
    Replies: 3
    Last Post: 14th March 2006, 13:29

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.