c++windowsqtipcurho3d

Running Urho3D and Qt from main


I am using the Urho3D engine with Qt for an application. The problem is that both Urho3D and QApplication require to be ran from main(). For now I am using it in separate processes but IPC makes it complicated. Is there any way to solve this issue? Thanks

My platform is Urho3D 1.5, Qt 4.71 and Windows 7 x64 and VS2015 (C++)


Solution

  • So the answer is quite simple. Instead of running QApplication by calling

    app->exec();
    

    it is needed to manually and regularily call this from your main loop:

    app->processEvents();
    

    This will take care that all events used by Qt are processed and QApplication will respond accordingly. Example:

    #include <QApplication>
    #include <awidget.h>
    
    int main(int argc, char* argv[])
    {
        QApplication app(argc, argv);
        bool shallrun = true;
        aWidget *widget = new aWidget();
        widget->show();
    
        while (shallrun)
        {
           app->processEvents();
           ...
        }
    
        ...
    }