Results 1 to 4 of 4

Thread: Interface methods question

  1. #1
    Join Date
    Apr 2007
    Posts
    117
    Thanks
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Interface methods question

    Here is an interface
    Qt Code:
    1. #ifndef INTERFACES_H
    2. #define INTERFACES_H
    3. #include <QtPlugin>
    4. #include <QtGui>
    5. #include <QList>
    6. class QImage;
    7. class QString;
    8.  
    9. class FilterInterface
    10. {
    11. public:
    12. virtual ~FilterInterface(){}
    13. virtual QStringList filters() const = 0;
    14.  
    15. virtual QImage filterImage(const QString &filter, const QImage &image,
    16. QWidget *parent) = 0;
    17. virtual QList<QImage> filterImageList(QString &filter, const QImage &image, QWidget *parent) = 0;
    18.  
    19. };
    20. Q_DECLARE_INTERFACE(FilterInterface,
    21. "com.iadfuq.sp.filterplugin.FilterInterface/1.0")
    22.  
    23. #endif
    To copy to clipboard, switch view to plain text mode 

    This is copied from the plug and paint example of Qt. Only difference is I added a method called filterImageList that must return a QList of QImage.

    Now I am trying to use with
    Qt Code:
    1. const QList<QImage> images = iFilter->filterImageList(action->text(),
    2. pixmapItem->pixmap().toImage(), 0);
    To copy to clipboard, switch view to plain text mode 

    I get the error

    mainwindow.cpp:1606: error: no matching function for call to ‘FilterInterface::filterImageList(QString, QImage, int)’
    interfaces.h:20: note: candidates are: virtual QList<QImage> FilterInterface::filterImageList(QString&, const QImage&, QWidget*)
    Is there something wrong with the way I declare QList<QImage> images?
    Image Analysis Development Framework Using Qt (IADFUQ)

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

    Default Re: Interface methods question

    Modify the interface to be:
    FilterInterface::filterImageList(const QString&, const QImage&, QWidget*)

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

    sincnarf (5th October 2007)

  4. #3
    Join Date
    Apr 2007
    Posts
    117
    Thanks
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Interface methods question

    Ok that worked. What's the use of const and virtual keywords anyway...... so that I may learn....
    Image Analysis Development Framework Using Qt (IADFUQ)

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

Similar Threads

  1. Qt interface running extremely slowly...
    By jazztpt in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2006, 11:12

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.