dear wysota
would you please read my initial posting and then ask yourself, if your last statement is helpful in any way ? Did I say anywhere, that I expected the receiver (QLineEdit) to be informed? No, I didn't.
This is my class.
class TestObject
: public QObject { Q_OBJECT
public:
virtual ~TestObject();
void ask();
public slots:
void setText(const QString&);
void objectDestroyed
(QObject * obj
);
signals:
void textChanged(const QString&);
protected:
Q_DISABLE_COPY(TestObject);
virtual void connectNotify ( const char * signal );
virtual void disconnectNotify ( const char * signal );
};
class TestObject : public QObject {
Q_OBJECT
public:
TestObject(QObject *parent = 0);
virtual ~TestObject();
void ask();
public slots:
void setText(const QString&);
void objectDestroyed(QObject * obj);
signals:
void textChanged(const QString&);
protected:
Q_DISABLE_COPY(TestObject);
virtual void connectNotify ( const char * signal );
virtual void disconnectNotify ( const char * signal );
};
To copy to clipboard, switch view to plain text mode
I connect a QLineEdit's setText-slot to the TestObject's textChanged-signal. Then I destroy the QLineEdit. Then I expect the TestObject's disconnectNotify method to be invoked. This doesn't happen.
You asked me, why I expect that.
I expect that, because I learned 30 years ago, that a method's name is a promise.
I have to fulfill this promise or I have to tell the user, why I don't fulfill it under certain conditions.
I expect it, because I think it's bad style not to call it without informing the user about a behaviour that ist not foreseeable from the method's name nor the documentation.
Bookmarks