Version: (using KDE KDE 3.4.2) Compiler: gcc 4.0.1 OS: Linux It seems like protected and private slots don't work the same way in QtRuby as they do in pure Qt. For example: class VC < Qt::Widget slots 'myPublicSlot()','myProtectedSlot()','myPrivateSlot()' def myPublicSlot end protected def myProtectedSlot end private def myPrivateSlot end end $vc = VC.new $b = Qt::PushButton.new(nil) Qt::Object::connect($b, SIGNAL('clicked()'), $vc, SLOT('myPublicSlot()')) Qt::Object::connect($b, SIGNAL('clicked()'), $vc, SLOT('myProtectedSlot()')) Qt::Object::connect($b, SIGNAL('clicked()'), $vc, SLOT('myPrivateSlot()')) All three connections work, even though in the C++ sense I'd only expect the first one to work.
On Friday 05 August 2005 10:16, Christian Loose wrote: [bugs.kde.org quoted mail] I tried this in C++ and it does exactly the same thing. This program gives no compile or runtime errors: class TrySlots: public QMainWindow { Q_OBJECT public slots: void myPublicSlot(); protected slots: void myProtectedSlot(); private slots: void myPrivateSlot(); ... void TrySlots::myPublicSlot() { printf("In myPublicSlot()\n"); } void TrySlots::myProtectedSlot() { printf("In myProtectedSlot()\n"); } void TrySlots::myPrivateSlot() { printf("In myPrivateSlot()\n"); } ... TrySlots * win = new TrySlots(); QPushButton * b = new QPushButton(win); win->show(); QObject::connect(b, SIGNAL(clicked()), mw, SLOT(myPublicSlot())); QObject::connect(b, SIGNAL(clicked()), mw, SLOT(myProtectedSlot())); QObject::connect(b, SIGNAL(clicked()), mw, SLOT(myPrivateSlot())); When I click the button, it outputs: In myPublicSlot() In myProtectedSlot() In myPrivateSlot() -- Richard
Wow, you're right. I've always taken this behavior for granted and coded based on the premise. The signalsandslots doc at the Trolltech website explains this as an expected type of behavior, so I'm a little surprised.
This is not a bug. This is even documented in Qt: The Signal/Slot mechanism ignores visibility.
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.
QtRuby only existed for Qt4 and Korundum, which never got updated for 5.x This is unmaintained and any effort towards QtRuby for Qt6 will be from scratch. Therefore, closing this ticket