I would thank if you tell me how to inherit two classes in qt.
I have several objects, each of which may connect to serial port via producer and consumer.
So, for emission n reception I need to connect the serial object inside producer and consumer classes to the other object outside.

Now, my producer n consumer class look like this:
Qt Code:
  1. extern const int DataSize;
  2. extern const int BufferSize;
  3. extern char buffer[100];
  4.  
  5. extern QWaitCondition bufferNotEmpty;
  6. extern QWaitCondition bufferNotFull;
  7. extern QMutex mutex;
  8.  
  9. extern int numUsedBytes;
  10.  
  11. class Producer : public QThread
  12. {
  13. public:
  14. Producer();
  15. void run();
  16.  
  17. private:
  18.  
  19. rs485 *rs_485;
  20. };
To copy to clipboard, switch view to plain text mode 

I tried adding QObject as well, but it prompted errrors.
i did this
Qt Code:
  1. #ifndef PRODUCER_H
  2. #define PRODUCER_H
  3.  
  4. #include <QWaitCondition>
  5. #include <QThread>
  6. #include <QMutex>
  7. #include <QTime>
  8.  
  9. #include <QSemaphore>
  10. #include "rs485.h"
  11.  
  12. extern const int DataSize;
  13. extern const int BufferSize;
  14. extern char buffer[100];
  15.  
  16. extern QWaitCondition bufferNotEmpty;
  17. extern QWaitCondition bufferNotFull;
  18. extern QMutex mutex;
  19.  
  20. extern int numUsedBytes;
  21.  
  22. class Producer : public QObject, public QThread
  23. {
  24. Q_OBJECT
  25. public:
  26. explicit Producer(QObject *parent = 0);
  27. void run();
  28.  
  29. public slots:
  30. void ProducerWritePacket(QByteArray);
  31. private:
  32.  
  33. rs485 *rs_485;
  34. };
  35.  
  36.  
  37.  
  38.  
  39. #endif // PRODUCER_H
To copy to clipboard, switch view to plain text mode 

and here's the error:

‘QObject’ is an ambiguous base of ‘Producer’