Seite 1 von 1

Eigene Klassen kasten

Verfasst: 25. Oktober 2008 19:36
von reuabreliz
Also ich habe eine eigene Klasse geschrieben MyComboBox. Ist eine erweiterte ComboBox einfach mit 2 Buttons daneben. Jetzt will ich ein Objekt in diese Klasse MyComboBox casten. Was muss ich dafür tun?

Bei dieser Zeile

Code: Alles auswählen

MyComboBox *combo = qobject_cast<MyComboBox *>( editor ); 
bringt mir der Kompiler folgende Fehlermeldung:

/usr/include/qt4/QtGui/qwidget.h: In member function »void QWidget::qt_check_for_QOBJECT_macro(const T&) const [with T = MyComboBox]«:
/usr/include/qt4/QtCore/qobject.h:431: instantiated from »T qobject_cast(QObject*) [with T = MyComboBox*]«
src/myTableDelegate.cpp:29: instantiated from here
/usr/include/qt4/QtGui/qwidget.h:139: Fehler: void-Wert nicht ignoriert wie es sein sollte


Bitte hilft mir jemand dabei. und wenn es geht möglichst bald. Vielleicht noch als nebenInfo die Klasse MyComboBox erbt von QWidget und hat die 3 Attribute QComboBox, QPushButton, QPushbutton.

Verfasst: 25. Oktober 2008 20:36
von Christian81
Q_OBJECT vergessen