本文整理汇总了C++中QAbstractEventDispatcher::processEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractEventDispatcher::processEvents方法的具体用法?C++ QAbstractEventDispatcher::processEvents怎么用?C++ QAbstractEventDispatcher::processEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractEventDispatcher
的用法示例。
在下文中一共展示了QAbstractEventDispatcher::processEvents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stop
void Waiter::stop(bool retValue)
{
timer_.stop();
QAbstractEventDispatcher * eventDispatcher = QAbstractEventDispatcher::instance();
if (eventDispatcher) {
while (eventDispatcher->processEvents(QEventLoop::AllEvents));
}
eventLoop_.exit(retValue ? 0 : 1);
}
示例2: flags
bool QX11Data::clipboardWaitForEvent(Window win, int type, XEvent *event, int timeout)
{
QElapsedTimer started;
started.start();
QElapsedTimer now = started;
if (QAbstractEventDispatcher::instance()->inherits("QtMotif")
|| QApplication::clipboard()->property("useEventLoopWhenWaiting").toBool()) {
if (waiting_for_data) {
Q_ASSERT(!"QClipboard: internal error, qt_xclb_wait_for_event recursed");
return false;
}
waiting_for_data = true;
has_captured_event = false;
capture_event_win = win;
capture_event_type = type;
QApplication::EventFilter old_event_filter =
qApp->setEventFilter(qt_x11_clipboard_event_filter);
do {
if (XCheckTypedWindowEvent(display, win, type, event)) {
waiting_for_data = false;
qApp->setEventFilter(old_event_filter);
return true;
}
XSync(X11->display, false);
usleep(50000);
now.start();
QEventLoop::ProcessEventsFlags flags(QEventLoop::ExcludeUserInputEvents
| QEventLoop::ExcludeSocketNotifiers
| QEventLoop::WaitForMoreEvents
| QEventLoop::X11ExcludeTimers);
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
eventDispatcher->processEvents(flags);
if (has_captured_event) {
waiting_for_data = false;
*event = captured_event;
qApp->setEventFilter(old_event_filter);
return true;
}
} while (started.msecsTo(now) < timeout);
waiting_for_data = false;
qApp->setEventFilter(old_event_filter);
} else {
do {
if (XCheckTypedWindowEvent(X11->display,win,type,event))
return true;
// process other clipboard events, since someone is probably requesting data from us
XEvent e;
if (XCheckIfEvent(X11->display, &e, checkForClipboardEvents, 0))
qApp->x11ProcessEvent(&e);
now.start();
XFlush(X11->display);
// sleep 50 ms, so we don't use up CPU cycles all the time.
struct timeval usleep_tv;
usleep_tv.tv_sec = 0;
usleep_tv.tv_usec = 50000;
select(0, 0, 0, 0, &usleep_tv);
} while (started.msecsTo(now) < timeout);
}
return false;
}