[gelöst] Verständnissproblem mit connect und Typen
Verfasst: 12. Juni 2007 02:05
Hi ihrs!
Als kleine Vorwarnung: Ich bin frisch mit C++ und noch frischer mit QT
Ich habe in meinem Programm ein Objekt controller der Klasse PositionController.
Selbige Klasse hat ein Signal ms(QString) welches im Header so definiert wird:
im Entsprechenden C++-File emitte ich das Signal dann wie folgt:
Anschließend lege ich mir zum Debuggen einen QPushButton an, in dem ich über das SIGNAL aus dem PositionController ein "bla" darstellen will und connecte diesen wie folgt:
Wenn ich das ganze nun kompilieren will haut mir mein g++ folgendes um die Ohren:
Was übersehe ich da grade?
mfl
Robin
Als kleine Vorwarnung: Ich bin frisch mit C++ und noch frischer mit QT
Ich habe in meinem Programm ein Objekt controller der Klasse PositionController.
Selbige Klasse hat ein Signal ms(QString) welches im Header so definiert wird:
Code: Alles auswählen
16 signals:
21 void ms(QString msg);
Code: Alles auswählen
emit ms(QString msg("bla")); // Normal was dynamisches, aber zum Debuggen lieber einfach halten.Code: Alles auswählen
10 QPushButton test("Hello world!");
11 test.show();
12 QObject::connect(controller, SIGNAL(ms(QString)), test, SLOT(setText(QString)));Wenn ich das ganze nun kompilieren will haut mir mein g++ folgendes um die Ohren:
Ich verstehe den error nicht ganz, da ja sowohl QPushButton, als auch PositionController Childs vom QObject sind und die ja laut letzer Zeile gefordert werden.g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:12: error: no matching function for call to ‘QObject::connect(PositionController&, const char [13], QPushButton&, const char [18])’
/usr/include/qt4/QtCore/qobject.h:181: note: candidates are: static bool QObject::connect(const QObject*, const char*, const QObject*, const char*, Qt::ConnectionType)
/usr/include/qt4/QtCore/qobject.h:282: note: bool QObject::connect(const QObject*, const char*, const char*, Qt::ConnectionType) const
Was übersehe ich da grade?
mfl
Robin