Hi,

I'm writing some classes to handle text that is transmitted over a serial communication link. There will be classes to 'observe' what is passing over the link. They are like textedits or linedits that show the data as it is received. Other classes will do logging etc.

I defined a base class for the observers with the necessary slots for receiving data. Then I derived a QUI object from this, based on a QPlainTextEdit. Like this :

Qt Code:
  1. class CComLineObserver : public QObject
  2. {
  3. Q_OBJECT
  4. public:
  5. explicit CComLineObserver(QObject *parent = 0);
  6.  
  7. public slots:
  8. virtual void OnTxLine( QString sLine );
  9. virtual void OnRxLine( QString sLine );
  10. virtual void OnRxChar( QString sLine );
  11.  
  12. };
  13.  
  14. class CComLineTextEdit : public QPlainTextEdit, virtual public CComLineObserver
  15. {
  16. Q_OBJECT
  17. public:
  18. explicit CComLineTextEdit( QWidget * parent = 0 );
  19.  
  20. public slots:
  21. virtual void OnRxLine( QString sLine );
  22. };
To copy to clipboard, switch view to plain text mode 

When I use this CComLineTextEdit in a form, I get the following error message in setupUI of the UI_....H file that moc builds (teLog is the name of the gui object) :

Qt Code:
  1. ambiguous acces of 'setObjectName'
  2. teLog->setObjectName(QString::fromUtf8("teLog"));
To copy to clipboard, switch view to plain text mode 

I think it has to do with the fact that both QPlainTextEdit and CComLineTextEdit are derived from QObject (the 'diamond problem'). I already used the 'virtual' keyword before 'CComLineTextEdit', but this doesn't help. I'm sure it's just a little syntax problem, but I just can't put my finger on it.

Does anyone know the solution ?

Thanks,
Marc