Bug 110194 - QtRuby: connecting to protected and private slots always works
Summary: QtRuby: connecting to protected and private slots always works
Status: RESOLVED UNMAINTAINED
Alias: None
Product: bindings
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-04 23:49 UTC by Caleb Tennis
Modified: 2022-12-22 06:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caleb Tennis 2005-08-04 23:49:13 UTC
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.
Comment 1 Richard Dale 2005-08-05 12:17:57 UTC
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
Comment 2 Caleb Tennis 2005-08-05 15:39:59 UTC
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.
Comment 3 David Palacio 2009-01-11 17:55:49 UTC
This is not a bug. This is even documented in Qt: The Signal/Slot mechanism ignores visibility.
Comment 4 Justin Zobel 2021-03-09 05:24:45 UTC
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.
Comment 5 Mathieu Jobin 2022-12-22 06:51:10 UTC
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