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 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.

  2. #2
    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 

  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 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.