QObject::connect()
にenumパラメータを使用しようとしています。私はQObject :: connect()with enum parameters
QObject::connect: Incompatible sender/receiver arguments
Calendar::calendarExceptionThrown(Calendar*,ExceptionType)
--> CalendarDBView::handleCalendarException(Calendar*,Calendar::ExceptionType)
...このメッセージを得た接続コードは次のとおりです。
connect(cal, SIGNAL(calendarExceptionThrown(Calendar*,ExceptionType)),
this, SLOT(handleCalendarException(Calendar*,Calendar::ExceptionType)));
私が何を読んでから、私は私がCalendar
のクラス定義にこれを追加する必要考え出し:
Q_ENUMS(ExceptionType)
私はmain.cpp
にこれを追加しました:
qRegisterMetaType<Calendar::ExceptionType>("ExceptionType");
を
まだ警告メッセージが表示されています。 This related threadは私の問題を解決しませんでした。私は間違って何をしていますか?
接続を行っている場所のどこに行を投稿できますか?タイプを 'Calendar :: ExceptionType'として登録しようとしましたか? – Mat
この行は 'connect(cal、SIGNAL(calendarExceptionThrown(Calendar *、ExceptionType))、this、SLOT(calendarCalendarException(Calendar *、Calendar :: ExceptionType)));'です。 – Pieter
SIGNALマクロとSLOTマクロの両方でCalendar :: ExceptionTypeを使用する必要があります。また、信号とスロットの宣言にその信号がどのように含まれているかを確認する必要があります。 Qtの弱点です。シグナル/スロットシグネチャの文字列を使用するため、スコープの解決に問題があります。 –