Re: [sigc] is possible make the emission of a signal private for a particular class?



Recently I had an idea to help with this.

The connect and disconnect methods should look like:
ret method(...) const;

and the emit method should looks like:
ret method(...);

The PushButton widget should looks like:

class PushButton: public Widget
{
public:
  const sigc::signal<void> &get_on_clicked() const
  {
    return sigc::on_clicked;
  }
private: // or protected
  sigc::signal<void> on_clicked;
}

Then the class members could emit the signal and non-members could connect and disconnect the signal. It's a simple and efficient way to resolve the problem. I care if there are problems with this approach.

2010/5/6 VinIPSmaker <vini ipsmaker gmail com>
I can develop the weak_signal class, and integrate with libSigC++ Extras maybe, or I can develop it and use only for me, closed to the rest of the world.
Is anyone wanting help me?


private:
  sigc::signal<void> signal;
public:
  sigc::weak_signal<void> on_clicked(signal, SIGNAL_IS_CONNECTABLE);

2010/5/6 Stephan Beal <stephan s11n net>
On Thu, May 6, 2010 at 8:45 AM, Murray Cumming <murrayc murrayc com> wrote:
I'm not sure that Qt's signals can't be emitted by other classes, though
I'd like to know for sure.

It's true - Qt signals are either private or protected, i don't remember which. i do remember, however, adding proxy functions to allow other classes to fire the signal, e.g.

public:
void emitMySignal()
{
  emit ....;
}
 
--
----- stephan beal
http://wanderinghorse.net/home/stephan/

_______________________________________________
libsigc-list mailing list
libsigc-list gnome org
http://mail.gnome.org/mailman/listinfo/libsigc-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]