本文整理汇总了C++中processEvents函数的典型用法代码示例。如果您正苦于以下问题:C++ processEvents函数的具体用法?C++ processEvents怎么用?C++ processEvents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了processEvents函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: processEvents
void DirectShowEventLoop::customEvent(QEvent *event)
{
if (event->type() == QEvent::User) {
processEvents();
} else {
QObject::customEvent(event);
}
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:8,代码来源:directshoweventloop.cpp
示例2: pixmap
bool DesignerApp::initApplication(QString cmdLine)
{
QLocale::setDefault(QLocale(QLocale::English));
QTextCodec::setCodecForTr(QTextCodec::codecForLocale());
QPixmap pixmap(":/designer/splash.png");
QSplashScreen *splash = new QSplashScreen(pixmap);
splash->show();
splash->showMessage(tr("Loading..."));
processEvents();
writeConfigValue("", "apppath", QtSingleApplication::applicationFilePath());
dbIgame = QSqlDatabase::addDatabase("QMYSQL","igame");
dbIgame.setDatabaseName("MoDeL");
dbIgame.setHostName("localhost");
dbIgame.setUserName("root");
dbIgame.setPassword("lovewin");
dbIgame.open();
DesignerViewMgr::initializeIfNotYet();
DesignerDocMgr::initializeIfNotYet();
DesignerModelMgr::initializeIfNotYet();
DesignerExtensionMgr::initializeIfNotYet();
DesignerMainWnd* mainWnd = DesignerMainWnd::globalCreateNewMainWnd();
setActivationWindow(mainWnd);
QObject::connect(this, SIGNAL(messageReceived(const QString&)), mainWnd, SLOT(instanceMessageReceived(const QString&)));
splash->setWindowFlags(Qt::WindowStaysOnTopHint);
splash->setParent(mainWnd);
splash->show();
QTimer::singleShot(1500, splash, SLOT(close()));
if(cmdLine!="/new")
mainWnd->instanceMessageReceived(cmdLine);
while(splash->isVisible())
{
processEvents();
}
return true;
}
开发者ID:igemsoftware,项目名称:USTC-Software_2011,代码行数:46,代码来源:DesignerApp.cpp
示例3: while
void Game::run()
{
while (mWindow.isOpen())
{
processEvents();
render();
}
}
开发者ID:MORTAL2000,项目名称:15-Puzzle-Game,代码行数:8,代码来源:Game.cpp
示例4: while
void Game::run()
{
sf::Clock clock;
sf::Time timeSinceLastUpdate = sf::Time::Zero;
while (mWindow.isOpen())
{
processEvents();
timeSinceLastUpdate += clock.restart();
while (timeSinceLastUpdate > TimePerFrame)
{
timeSinceLastUpdate -= TimePerFrame;
processEvents();
update(TimePerFrame);
}
render();
}
}
开发者ID:lukitree,项目名称:Testing,代码行数:17,代码来源:Game.cpp
示例5: DBG
void AmCallWatcher::run() {
DBG("starting call watcher.\n");
garbage_collector->start();
while (true) {
waitForEvent();
processEvents();
}
}
开发者ID:sems-server,项目名称:sems,代码行数:8,代码来源:AmCallWatcher.cpp
示例6: while
/**
* Waits for new OSX event (TODO: thread)
* Virtual
*
* @return RawEvent object
*/
void EventMonitorMac::waitForEvents() {
int i = 10;
while ( events.size() == 0 ) {
// Wait for some event
processEvents();
usleep(75000);
}
}
开发者ID:psprint,项目名称:keyfrog,代码行数:14,代码来源:EventMonitorMac.cpp
示例7: while
void TuioDemo::run() {
running=true;
while (running) {
drawObjects();
processEvents();
SDL_Delay(40);
}
}
开发者ID:Ahmedn1,项目名称:ccv-hand,代码行数:8,代码来源:TuioDemo.cpp
示例8: run
void run() {
do {
processEvents();
update();
render();
}
while (_window.isOpen());
}
开发者ID:xeloni,项目名称:ProjetsClion,代码行数:8,代码来源:application.hpp
示例9: processEvents
void InputSystem::tick()
{
if (!m_isCapturing) {
return;
}
processEvents();
}
开发者ID:CharlieCraft,项目名称:axonengine,代码行数:8,代码来源:event.cpp
示例10: ERR_PRINT
// ============================================================================
ssize_t PacketManager::sendto_Err(int s, void *buf, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
int nResult = 0;
if (buf == NULL)
{
ERR_PRINT("buf pointer == NULL\n");
exit(1);
}
if (len == 0)
{
ERR_PRINT("len == 0: %u\n", len);
exit(1);
}
if (to == NULL)
{
ERR_PRINT("sockaddr pointer == NULL\n");
exit(1);
}
++m_MsgNo;
uint32_t seqNo = ntohl(*(uint32_t*)(buf));
MSG_PRINT("MSG# %3u SEQ# %3u LEN %4u FLAGS 0x%08X\n", m_MsgNo, seqNo, len, flags);
size_t lenTmp = len;
unsigned char bufTmp[len];
memcpy(bufTmp, buf, lenTmp);
void* pBuf = bufTmp;
nResult = processEvents((void**)&pBuf, &lenTmp, m_MsgNo);
if (nResult < 0)
{
ERR_PRINT("prcoessEvents\n");
return nResult;
}
else if ((nResult == 0) || (nResult == 1))
{
ssize_t lenSent = sendto(s, pBuf, lenTmp, flags, to, tolen);
if (lenSent == (ssize_t)lenTmp)
{
return len;
}
else
{
return lenSent;
}
}
else
{
return len;
}
return -1;
}
开发者ID:pauloliver,项目名称:networkChat,代码行数:59,代码来源:PacketManager.cpp
示例11: main
int main(int argc, const char** argv)
{
XInitThreads();
s_display = XOpenDisplay(0);
int32_t screen = DefaultScreen(s_display);
int32_t depth = DefaultDepth(s_display, screen);
Visual* visual = DefaultVisual(s_display, screen);
Window root = RootWindow(s_display, screen);
XSetWindowAttributes windowAttrs = { 0 };
windowAttrs.background_pixmap = 0;
windowAttrs.border_pixel = 0;
windowAttrs.event_mask = 0
| ButtonPressMask
| ButtonReleaseMask
| ExposureMask
| KeyPressMask
| KeyReleaseMask
| PointerMotionMask
| StructureNotifyMask
;
int width = 800;
int height = 600;
s_window = XCreateWindow(s_display
, root
, 0, 0
, width, height, 0, depth
, InputOutput
, visual
, CWBorderPixel | CWEventMask
, &windowAttrs
);
// Clear window to black.
XSetWindowAttributes attr = { 0 };
XChangeWindowAttributes(s_display, s_window, CWBackPixel, &attr);
const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
XInternAtoms(s_display, (char**)&wmDeleteWindowName, 1, False, &wmDeleteWindow);
XSetWMProtocols(s_display, s_window, &wmDeleteWindow, 1);
XMapWindow(s_display, s_window);
XStoreName(s_display, s_window, "ProDBG");
bgfx::x11SetDisplayWindow(s_display, s_window);
ProDBG_create((void*)s_window, width, height);
processEvents();
XUnmapWindow(s_display, s_window);
XDestroyWindow(s_display, s_window);
return EXIT_SUCCESS;
}
开发者ID:RobertoMalatesta,项目名称:ProDBG,代码行数:58,代码来源:linux_main.cpp
示例12: while
void MenuServeur::run()
{
while (mWindow.isOpen())
{
// musiccc();
processEvents();
render();
}
}
开发者ID:othmane123,项目名称:ProjetMorpion,代码行数:9,代码来源:MenuServeur.cpp
示例13: App
int Application::main(int argc, char **argv) {
app = new App(argc, argv);
#if !defined(_WIN32)
//Windows port uses 256x256 icon from resource file
app->setWindowIcon(QIcon(":/bsnes.png"));
#endif
initargs(argc, argv); //ensure argv[]s are in UTF-8 format
initPaths(argv[0]);
locateFile(configFilename = "bsnes.cfg", true);
locateFile(styleSheetFilename = "style.qss", false);
string customStylesheet;
if(customStylesheet.readfile(styleSheetFilename) == true) {
app->setStyleSheet((const char*)customStylesheet);
} else {
app->setStyleSheet(defaultStylesheet);
}
config.load(configFilename);
init();
snes.init();
if(argc == 2) {
//if valid file was specified on the command-line, attempt to load it now
utility.loadCartridge(argv[1]);
}
while(terminate == false) {
processEvents();
utility.updateSystemState();
inputManager.refresh();
if(config.input.focusPolicy == Configuration::Input::FocusPolicyPauseEmulation) {
bool inactive = (winMain->window->isActiveWindow() == false);
if(!autopause && inactive) {
autopause = true;
audio.clear();
} else if(autopause && !inactive) {
autopause = false;
}
} else {
autopause = false;
}
if(cartridge.loaded() && !pause && !autopause) {
snes.runtoframe();
} else {
usleep(20 * 1000);
}
supressScreenSaver();
}
config.save(configFilename);
return 0;
}
开发者ID:Godzil,项目名称:quickdev16,代码行数:57,代码来源:main.cpp
示例14: run
void run()
{
while (mWindow.isOpen())
{
processEvents();
update();
render();
}
}
开发者ID:gato0429,项目名称:ForgeGame,代码行数:9,代码来源:main.cpp
示例15: while
void PongGame::run() {
sf::Clock clock;
sf::Time timeSinceLastUpdate = sf::Time::Zero;
while (mainWindow.isOpen()) {
processEvents();
sf::Time elapsedTime = clock.restart();
timeSinceLastUpdate += elapsedTime;
while (timeSinceLastUpdate > timePerFrame) {
timeSinceLastUpdate -= timePerFrame;
processEvents();
// no matter what happens, give the same delta time to the update function
update();
}
updateStatistics(elapsedTime);
render();
}
}
开发者ID:Yves-T,项目名称:SFML_Pong,代码行数:18,代码来源:PongGame.cpp
示例16: while
void GameEngine::run(void)
{
sf::Clock clock;
sf::Time lastUpdate = sf::Time::Zero;
while(_mWindow.isOpen())
{
processEvents();
lastUpdate += clock.restart();
while (lastUpdate > _timePerFrame)
{
lastUpdate -= _timePerFrame;
processEvents();
update(_timePerFrame); // A revoir
}
render();
}
}
开发者ID:Ismuur,项目名称:NomDeCode,代码行数:18,代码来源:GameEngine.cpp
示例17: while
void Game::run()
{
while (mWindow.isOpen())
{
processEvents();
update(timePerFrame);
render();
}
}
开发者ID:hikarido,项目名称:SFML_TEST_1,代码行数:9,代码来源:Game.cpp
示例18: exit
/*!
Enters the main event loop and waits until exit() is called.
Returns the value that was passed to exit().
If \a flags are specified, only events of the types allowed by
the \a flags will be processed.
It is necessary to call this function to start event handling. The
main event loop receives events from the window system and
dispatches these to the application widgets.
Generally speaking, no user interaction can take place before
calling 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().
\sa QCoreApplication::quit(), exit(), processEvents()
*/
int QEventLoop::exec(ProcessEventsFlags flags)
{
Q_D(QEventLoop);
//we need to protect from race condition with QThread::exit
QMutexLocker locker(&static_cast<QThreadPrivate *>(QObjectPrivate::get(d->threadData->thread))->mutex);
if (d->threadData->quitNow)
return -1;
if (d->inExec) {
qWarning("QEventLoop::exec: instance %p has already called exec()", this);
return -1;
}
struct LoopReference {
QEventLoopPrivate *d;
QMutexLocker &locker;
bool exceptionCaught;
LoopReference(QEventLoopPrivate *d, QMutexLocker &locker) : d(d), locker(locker), exceptionCaught(true)
{
d->inExec = true;
d->exit.storeRelease(false);
++d->threadData->loopLevel;
d->threadData->eventLoops.push(d->q_func());
locker.unlock();
}
~LoopReference()
{
if (exceptionCaught) {
qWarning("Qt has caught an exception thrown from an event handler. Throwing\n"
"exceptions from an event handler is not supported in Qt.\n"
"You must not let any exception whatsoever propagate through Qt code.\n"
"If that is not possible, in Qt 5 you must at least reimplement\n"
"QCoreApplication::notify() and catch all exceptions there.\n");
}
locker.relock();
QEventLoop *eventLoop = d->threadData->eventLoops.pop();
Q_ASSERT_X(eventLoop == d->q_func(), "QEventLoop::exec()", "internal error");
Q_UNUSED(eventLoop); // --release warning
d->inExec = false;
--d->threadData->loopLevel;
}
};
LoopReference ref(d, locker);
// remove posted quit events when entering a new event loop
QCoreApplication *app = QCoreApplication::instance();
if (app && app->thread() == thread())
QCoreApplication::removePostedEvents(app, QEvent::Quit);
while (!d->exit.loadAcquire())
processEvents(flags | WaitForMoreEvents | EventLoopExec);
ref.exceptionCaught = false;
return d->returnCode.load();
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:80,代码来源:qeventloop.cpp
示例19: setOpaqueChildren
void setOpaqueChildren(bool enable)
{
if (opaqueChildren != enable) {
foreach (QWidget *w, children)
w->setAttribute(Qt::WA_OpaquePaintEvent, enable);
opaqueChildren = enable;
processEvents();
}
}
开发者ID:KDE,项目名称:android-qt,代码行数:9,代码来源:tst_qwidget.cpp
示例20: startup
void Tasklet::run() {
platform::setThreadName("'"+name+"' (tasklet)");
isAlive = true;
bool hasError = false;
string errorMsg = "";
try {
// make sure that our GL context is the current context
if(window != NULL) {
window->context->makeCurrent();
}
startup();
if (running) {
double framerate = config.framerate;
double offset = clock.getTime();
while (thread->get_state() == TaskletThread::RUNNING && running) {
processEvents();
if (running) {
update(framerate);
render();
if(waitForEvents) { eventDispatcher->waitForEvents(); }
framerate = clock.getElapsedAndUpdateOffset(offset);
}
}
shutdown();
// unbind GL context
if(window != NULL) {
window->context->clearCurrent();
}
}
}
catch(std::exception& ex)
{
errorMsg = ex.what();
hasError = true;
}
catch (...) {
errorMsg = "<catch all>";
hasError = true;
}
isAlive = false;
dispatchApplicationEvent(TaskletEventPtr(new TaskletEvent(TaskletEvent::DONE(), this)));
if (hasError) {
std::ostringstream os;
os << "Tasklet '"<<name<<"' terminated with error: " <<errorMsg;
throw std::runtime_error(os.str());
}
}
开发者ID:Wednesnight,项目名称:lostengine,代码行数:56,代码来源:Tasklet.cpp
注:本文中的processEvents函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论