Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Crash when creating QQuickView from QTimer event

$
0
0
I try to create a QQuickView in a function that is triggered by a timer, but it triggers an exception. (The inferior stopped because it triggered an exception. …read access violation…) If I create a QQuickView manually before the timer triggers the function that creates a QQuickView, the program will not crash. Anybody know why this happens? What am I doing wrong? A bit of an bad explanation, but i hope the code explais it better. app.cpp #include "app.h" #include <QTimer>   App::App( int argc, char* argv[] )     : QGuiApplication( argc, argv )     , view( NULL ) {     // If the line below is included the program works     //QQuickView* tempView = new QQuickView();       QTimer::singleShot( 5000, this, SLOT( createView() ) ); }   void App::createView() {     view = new QQuickView(); } app.h #ifndef APP_H #define APP_H   #include <QGuiApplication> #include <QQuickView>   class App : public QGuiApplication {     Q_OBJECT public:     App( int, char** );   public slots:     void createView();   private:     QQuickView *view; };   #endif // APP_H main.cpp #include "app.h"   int main(int argc, char *argv[]) {     App app(argc, argv);     return app.exec(); }

Viewing all articles
Browse latest Browse all 4972

Trending Articles