[Qt-interest] moc / multiple inheritance issue
Stephen Jackson
spjackson42 at gmail.com
Mon Sep 14 10:38:16 CEST 2009
On Mon, Sep 14, 2009 at 1:21 AM, Jimmy Cooksey wrote:
>
> I have created a sample project demonstrating my problem:
> http://www.jimster.org/QtTestCase.zip
>
> Any help would be greatly appreciated!
>
I'm not sure that I can explain this without some more research.
However, with the following 2 changes to your code, declareYourself()
does what you want.
$ diff -r QtTestCase QtTestCase-spj
diff -r QtTestCase/mainwindow.cpp QtTestCase-spj/mainwindow.cpp
31c31
< ((DeclareYourself*) specialLineEdit)->declareYourself();
---
> ((SpecialLineEdit*) specialLineEdit)->declareYourself();
diff -r QtTestCase/speciallineedit.h QtTestCase-spj/speciallineedit.h
7c7
< class SpecialLineEdit : public virtual QLineEdit, public DeclareYourself
---
> class SpecialLineEdit : public QLineEdit, public DeclareYourself
Note that "Virtual inheritance with QObject is not supported." see
http://doc.trolltech.com/4.5/moc.html.
--
HTH,
Stephen Jackson
More information about the Qt-interest-old
mailing list