Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Q3Signal Class Reference

The Q3Signal class can be used to send signals for classes that don't inherit QObject. More...

    #include <Q3Signal>

This class is part of the Qt 3 compatibility library. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits QObject.

- List of all members, including inherited members

### Writable Properties

- 1 writable property inherited from QObject

### Public Functions

- Q3Signal ( QObject * parent = 0, const char * name = 0 )
- ~Q3Signal ()
- void activate ()
- void block ( bool b )
- bool connect ( const QObject * receiver, const char * member )
- bool disconnect ( const QObject * receiver, const char * member = 0 )
- bool isBlocked () const
- int parameter () const
- void setParameter ( int value )
- void setValue ( const QCoreVariant & value )
- QCoreVariant value () const

- 24 public functions inherited from QObject

### Public Slots

- 1 public slot inherited from QObject

### Signals

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QObject

### Protected Functions

- 9 protected functions inherited from QObject

## Detailed Description

The Q3Signal class can be used to send signals for classes that don't inherit QObject.

If you want to send signals from a class that does not inherit QObject, you can create an internal Q3Signal object to emit the signal. You must also provide a function that connects the signal to an outside object slot. This is how we have implemented signals in the QMenuData class, which is not a QObject.

In general, we recommend inheriting QObject instead. QObject provides much more functionality.

You can set a single QVariant parameter for the signal with setValue().

Note that QObject is a private base class of Q3Signal, i.e. you cannot call any QObject member functions from a Q3Signal object.

Example:

        #include <qsignal.h>

        class MyClass
        {
        public:
            MyClass();
            ~MyClass();

            void doSomething();

            void connect(QObject *receiver, const char *member);

        private:
            Q3Signal *sig;
        };

        MyClass::MyClass()
        {
            sig = new Q3Signal;
        }

        MyClass::~MyClass()
        {
            delete sig;
        }

        void MyClass::doSomething()
        {
            // ... does something
            sig->activate(); // emits the signal
        }

        void MyClass::connect(QObject *receiver, const char *member)
        {
            sig->connect(receiver, member);
        }

## Member Function Documentation

### Q3Signal::Q3Signal ( QObject * parent = 0, const char * name = 0 )

Constructs a signal object called name, with the parent object parent. These arguments are passed directly to QObject.

### Q3Signal::~Q3Signal ()

Destroys the signal. All connections are removed, as is the case with all QObjects.

### void Q3Signal::activate ()

Emits the signal. If the platform supports QVariant and a parameter has been set with setValue(), this value is passed in the signal.

### void Q3Signal::block ( bool b )

Use QObject::blockSignals(b) instead.

### bool Q3Signal::connect ( const QObject * receiver, const char * member )

Connects the signal to member in object receiver.

See also disconnect() and QObject::connect().

### bool Q3Signal::disconnect ( const QObject * receiver, const char * member = 0 )

Disonnects the signal from member in object receiver.

See also connect() and QObject::disconnect().

### bool Q3Signal::isBlocked () const

Uses QObject::signalsBlocked() instead.

### int Q3Signal::parameter () const

Returns the signal's parameter as an integer.

### void Q3Signal::setParameter ( int value )

Sets the signal's parameter to the given integer value.

### void Q3Signal::setValue ( const QCoreVariant & value )

Sets the signal's parameter to value

### QCoreVariant Q3Signal::value () const

Returns the signal's parameter