Merge branch 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging
* 'master' of git://scm.dev.nokia.troll.no/qt/qtbase-staging: Make error checking in QSignalSpy consistent
This commit is contained in:
commit
359c5e4a71
@ -68,8 +68,15 @@ public:
|
|||||||
#else
|
#else
|
||||||
static const int memberOffset = QObject::staticMetaObject.methodCount();
|
static const int memberOffset = QObject::staticMetaObject.methodCount();
|
||||||
#endif
|
#endif
|
||||||
Q_ASSERT(obj);
|
if (!obj) {
|
||||||
Q_ASSERT(aSignal);
|
qWarning("QSignalSpy: Cannot spy on a null object");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aSignal) {
|
||||||
|
qWarning("QSignalSpy: Null signal name is not valid");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (((aSignal[0] - '0') & 0x03) != QSIGNAL_CODE) {
|
if (((aSignal[0] - '0') & 0x03) != QSIGNAL_CODE) {
|
||||||
qWarning("QSignalSpy: Not a valid signal, use the SIGNAL macro");
|
qWarning("QSignalSpy: Not a valid signal, use the SIGNAL macro");
|
||||||
|
@ -62,7 +62,11 @@
|
|||||||
/*! \fn QSignalSpy::QSignalSpy(QObject *object, const char *signal)
|
/*! \fn QSignalSpy::QSignalSpy(QObject *object, const char *signal)
|
||||||
|
|
||||||
Constructs a new QSignalSpy that listens for emissions of the \a signal
|
Constructs a new QSignalSpy that listens for emissions of the \a signal
|
||||||
from the QObject \a object. Neither \a signal nor \a object can be null.
|
from the QObject \a object. If QSignalSpy is not able to listen for a
|
||||||
|
valid signal (for example, because \a object is null or \a signal does
|
||||||
|
not denote a valid signal of \a object), an explanatory warning message
|
||||||
|
will be output using qWarning() and subsequent calls to \c isValid() will
|
||||||
|
return false.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
\snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 4
|
\snippet doc/src/snippets/code/doc_src_qsignalspy.cpp 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user