Results 1 to 3 of 3

Thread: Abstract signals?

  1. #1
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Abstract signals?

    I have a plugin that implements interface (class with abstract methods) and that's all that this plugin exposes. How to make this interface signal-aware?

    class IDataConnector : public QObject
    {
    Q_OBJECT
    public:
    virtual ~IDataConnector() {};
    signals:
    virtual void OnUpdate(QString msg) = 0;
    };
    ...
    Q_DECLARE_INTERFACE(IDataConnector, "dataconnector/1.0")

    Compiler complains about signal being virtual, but it's warning and not an error .
    Client can connect to the signal (QObject::connect returns true), but "emit OnUpdate" does not call the slot in the client.

    Any suggestions?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Abstract signals?

    what is the reason you declare the signal as virtual? a signal will never do anything else but notify the connected slots...
    also, you will have to take care that not both the plugin and the 'client' moc the plugin header.

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

    TorAn (22nd February 2010)

  4. #3
    Join Date
    Nov 2009
    Location
    US, Midwest
    Posts
    215
    Thanks
    62
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Abstract signals?

    You are right, got carried away with declaration of the interface.
    All works now, thanks

    Now, I did not understand your comment "you will have to take care that not both the plugin and the 'client' moc the plugin header."?
    Can you elablorate?

Similar Threads

  1. Choice between Standard- and Abstract Item Model
    By hunsrus in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2009, 15:14
  2. MVC - Abstract Widget Base Class - setupUI
    By SenSej in forum Newbie
    Replies: 0
    Last Post: 13th October 2008, 10:44
  3. QThread and signals (linux/UNIX signals not Qt Signals)
    By Micawber in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2007, 22:18
  4. Quick question regarding abstract classes and DLLs
    By durbrak in forum Qt Programming
    Replies: 1
    Last Post: 8th February 2007, 21:32
  5. abstract scroll area
    By moowy in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2006, 09:15

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.