QEventLoop Class Reference
|
enum | ProcessEventsFlag { AllEvents, ExcludeUserInputEvents, ExcludeSocketNotifiers, WaitForMoreEvents, DeferredDeletion } |
flags | ProcessEventsFlags |
QEventLoop ( QObject * parent = 0 ) | |
~QEventLoop () | |
int | exec ( ProcessEventsFlags flags = AllEvents ) |
void | exit ( int returnCode = 0 ) |
bool | isRunning () const |
bool | processEvents ( ProcessEventsFlags flags = AllEvents ) |
void | processEvents ( ProcessEventsFlags flags, int maxTime ) |
void | wakeUp () |
void | quit () |
The QEventLoop class provides a means of entering and leaving an event loop.
At any time, you can create a QEventLoop object and call exec() on it to start a local event loop. From within the event loop, calling exit() will force exec() to return.
See also QAbstractEventDispatcher.
This enum controls the types of events processed by the processEvents() functions.
Константа | Значение | Описание |
---|---|---|
QEventLoop::AllEvents | 0x00 | All events. Note that DeferredDelete events are processed specially. See QObject::deleteLater() for more details. |
QEventLoop::ExcludeUserInputEvents | 0x01 | Do not process user input events, such as ButtonPress and KeyPress. Note that the events are not discarded; they will be delivered the next time processEvents() is called without the ExcludeUserInputEvents flag. |
QEventLoop::ExcludeSocketNotifiers | 0x02 | Do not process socket notifier events. Note that the events are not discarded; they will be delivered the next time processEvents() is called without the ExcludeSocketNotifiers flag. |
QEventLoop::WaitForMoreEvents | 0x04 | Wait for events if no pending events are available. |
QEventLoop::DeferredDeletion | 0x10 | deprecated - do not use. |
The ProcessEventsFlags type is a typedef for QFlags<ProcessEventsFlag>. It stores an OR combination of ProcessEventsFlag values.
See also processEvents().
Constructs an event loop object with the given parent.
Destroys the event loop object.
Enters the main event loop and waits until exit() is called. Returns the value that was passed to exit().
If flags are specified, only events of the types allowed by the flags will be processed.
Эту функцию необходимо вызвать, чтобы начать обработку событий. Главный цикл обработки событий принимает события от оконной системы и отправляет их виджетам приложения.
Вообще говоря, не может происходить никакого взаимодействия с пользователем до вызова exec(). As a special case, modal widgets like QMessageBox can be used before calling exec(), because modal widgets use their own local event loop.
To make your application perform idle processing (i.e. executing a special function whenever there are no pending events), use a QTimer with 0 timeout. More sophisticated idle processing schemes can be achieved using processEvents().
See also QApplication::quit(), exit(), and processEvents().
Tells the event loop to exit with a return code.
After this function has been called, the event loop returns from the call to exec(). The exec() function returns returnCode.
By convention, a returnCode of 0 means success, and any non-zero value indicates an error.
Обратите внимание, что в отличие от библиотечной функции C с тем же именем, эта функция действительно возвращается в место вызова - она останавливает обработку событий.
See also QCoreApplication::quit(), quit(), and exec().
Returns true if the event loop is running; otherwise returns false. The event loop is considered running from the time when exec() is called until exit() is called.
Processes pending events that match flags until there are no more events to process. Returns true if pending events were handled; otherwise returns false.
This function is especially useful if you have a long running operation and want to show its progress without allowing user input; i.e. by using the ExcludeUserInputEvents flag.
This function is simply a wrapper for QAbstractEventDispatcher::processEvents(). See the documentation for that function for details.
Process pending events that match flags for a maximum of maxTime milliseconds, or until there are no more events to process, whichever is shorter. This function is especially useful if you have a long running operation and want to show its progress without allowing user input, i.e. by using the ExcludeUserInputEvents flag.
Примечания:
Tells the event loop to exit normally.
Same as exit(0).
See also QCoreApplication::quit() and exit().
Wakes up the event loop.
See also QAbstractEventDispatcher::wakeUp().
Авторские права © 2010 Nokia Corporation и/или её дочерние компании | Торговые марки | Qt 4.6.4 |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |