$> man42.net Blog written by a human

# Issues

  • You want to share your code logic through a base class.
  • Your code involves emitting signals.
  • You are stuck with the QObject multiple inheritance problem

# Solution

Here is a simple solution: use pure virtual methods instead of signals.

An example:

class DropLogic
  virtual ~BaseClass()

  void processDropEvent(QDropEvent *event)
    /* ... do something */


  virtual void notifySomething() const = 0;

class CustomTableView : public QTableView, public DropLogic
  void notifySomething() const;

Moreover, the compiler will tell you if you forgot to declare the signal in your derived class!

Happy coding :)

Buffer this pageShare on TumblrDigg thisShare on FacebookShare on LinkedInTweet about this on TwitterEmail this to someoneShare on Google+Share on RedditPin on Pinterest