Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QApplication error in exec()
Forum Update on Monday, May 27th 2025

QApplication error in exec()

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 4.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sasibu
    wrote on last edited by
    #1

    Hi all,

    I have a weird problem when my applicarion tries to execute @app.exec() //QApplication object in main.cpp@

    I'm trying to integrate an Ogre widget and a VTK widget on my application. All goes good if I use only one of them, but I get that error:

    @Unhandled exception at 0x00a1fd88 in QtApp.exe: 0xC0000005: Access violation reading location 0x0672faf0@

    I followed the error and it seems to crash on the Qt Core, when processing events in file "qapplicarion_win.cpp"
    @
    bool QGuiEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
    {
    if (!QEventDispatcherWin32::processEvents(flags)) //HERE CRASHES!!!!
    return false;

    if (configRequests)                        // any pending configs?
        qWinProcessConfigRequests();
    
    return true;
    

    }
    @

    I'm using Qt 4.7 under Windows 7.
    Have somebody any clue?

    Thanks a lot!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      I think you need to show some of your actual code before anyone can help you.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sasibu
        wrote on last edited by
        #3

        Here it goes.

        The 'main.cpp':

        @//Main
        int main(int argc, char *argv[])
        {
        QApplication app(argc, argv);
        MainWindow *mainWin = new MainWindow();
        mainWin->show();

        return app.exec();
        //while (true){}
        }
        @

        'MainWindow.h':
        @#ifndef MAINWINDOW_H
        #define MAINWINDOW_H

        //Qt
        #include <QMainWindow>

        #include "VTKWidget.h"
        #include "OgreWidget.h"

        namespace Ui {
        class MainWindow;
        }

        class MainWindow : public QMainWindow
        {
        Q_OBJECT

        public:
        explicit MainWindow(QWidget parent = 0);//, QtOgre::GameLogic gameLogic = 0);
        ~MainWindow();

        private:
        //Class Members
        Ui::MainWindow *ui;

        //Widgets
        VTKWidget *mVTKWidget;
        OgreWidget *mOgreWidget;
        };

        #endif // MAINWINDOW_H@

        And the constructor of 'MainWindow' in 'MainWindow.cpp':
        @MainWindow::MainWindow(QWidget *parent):
        QMainWindow(parent),
        ui(new Ui::MainWindow)
        {
        ui->setupUi(this);

        //Create Ogre Widget
        mOgreWidget = new OgreWidget( ui->widgetVis );
        mOgreWidget->resize(800, 600);

        ui->verticalLayoutWidgetVis->addWidget(mOgreWidget);
        ui->verticalLayoutWidgetVis->update();

        mOgreWidget->show();

        //Create VTK Widget
        //vtkRenderWindow* renWin = vtkRenderWindow::New();
        mVTKWidget = new VTKWidget(this);
        //mVTKWidget->SetRenderWindow(renWin);
        //mVTKWidget->createScene();
        //mVTKWidget->show();

        ui->verticalLayoutWidgetSmallVis->addWidget(mVTKWidget);
        ui->verticalLayoutWidgetSmallVis->update();

        }@

        I'm using the QVTKWidget from VTK source, and the Ogre widget like the defined "here":http://www.ogre3d.org/tikiwiki/QtOgre

        Thanks

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sasibu
          wrote on last edited by
          #4

          It seems that the problem is in the QVTKWidget provided. Concretly in the paintEvent().

          I have overloaded the function in my class and now all is working, so the problem is in the painting...

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            I don't know anything about QVTKWidget. Perhaps VTK has a forum or mailinglist you can use for support on that?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sasibu
              wrote on last edited by
              #6

              [quote author="Andre" date="1295452972"]I don't know anything about QVTKWidget. Perhaps VTK has a forum or mailinglist you can use for support on that?[/quote]

              It seems more an event queue problem of Qt, but maybe it's a VTK issue.

              Thanks!

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                Well, it could be that QVTKWidget tries to do some magic with Qt's eventloop, and that that causes the issue. But again: I really don't

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved