|
|
I've always been using protected and private slots under the guise that
connecting to them was prohibited based on conventional C++ rules, as stated
here:
http://doc.trolltech.com/3.3/signalsandslots.html
However, after some recent experimentation I've found that I can always
connect to and use protected and private slots. For example, in pseudocode:
class TrySlots: public QObject
{
Q_OBJECT
public slots:
void myPublicSlot() { qDebug("myPublicSlot"); }
protected slots:
void myProtectedSlot() { qDebug("myProtectedSlot"); }
private slots:
void myPrivateSlot() { qDebug("myPrivateSlot"); }
};
QApplication app(argv,argc);
TrySlots ts;
QObject::connect(&app, SIGNAL(aboutToQuit()), &ts, SLOT(myPublicSlot()));
QObject::connect(&app, SIGNAL(aboutToQuit()), &ts, SLOT(myProtectedSlot()));
QObject::connect(&app, SIGNAL(aboutToQuit()), &ts, SLOT(myPrivateSlot()));
The connections always work, and the slots are always called. I've tried a
number of iterations and variations and I'm always able to call protected and
private slots from any signal.
Is my logic just way off for a Friday morning or is something else amiss here?
|
|