Qt:Документация 4.3.2/q3signal
Материал из Wiki.crossplatform.ru
Внимание: Актуальная версия перевода документации находится здесь |
__NOTOC__
Главная · Все классы · Основные классы · Классы по группам · Модули · Функции |
[править] Q3Signal Class Reference
[ Qt3Support module]
The Q3Signal class can be used to send signals for classes that don't inherit QObject. Далее...
#include <Q3Signal>
This class is part of the Qt 3 support library. It is provided to keep old source code working. Мы настоятельно не рекомендуем использовать этот класс в новом коде. See Porting to Qt 4 for more information.
Inherits QObject.
[править] Открытые функции
- Q3Signal ( QObject * parent = 0, const char * name = 0 )
- ~Q3Signal ()
- void activate ()
- bool connect ( const QObject * receiver, const char * member )
- bool disconnect ( const QObject * receiver, const char * member = 0 )
- void setValue ( const QVariant & value )
- QVariant value () const
- 29 открытых функций, унаследованных от QObject
[править] Дополнительные унаследованные члены
- 1 свойство, унаследованное от QObject
- 1 открытый слот, унаследованный от QObject
- 1 сигнал, унаследованный от QObject
- 5 статических открытых членов, унаследованных от QObject
- 7 защищенных функций, унаследованных от QObject
[править] Подробное описание
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 used to implement signals in Qt 3's QMenuData class, which was not a QObject. In Qt 4, menus contain actions, which are QObjects.
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.
Пример:
#include <q3signal.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); }
[править] Описание функций-членов
[править] 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.
[править] bool Q3Signal::connect ( const QObject * receiver, const char * member )
Connects the signal to member in object receiver. Returns true if the connection is successful.
See also disconnect() and QObject::connect().
[править] bool Q3Signal::disconnect ( const QObject * receiver, const char * member = 0 )
Disonnects the signal from member in object receiver. Returns true if the connection existed and the disconnect was successful.
See also connect() and QObject::disconnect().
[править] void Q3Signal::setValue ( const QVariant & value )
Sets the signal's parameter to value
Смотрите также value().
[править] QVariant Q3Signal::value () const
Returns the signal's parameter
Смотрите также setValue().
Copyright © 2007 Trolltech | Trademarks | Qt 4.3.2
|