Calling Qfiledialog form openglwindow example



  • Link to code where calling gui elements cause problem
    If calling QFiledialog or new gui form main.cpp or openglwindow.cpp app crashes.
    Also tryed creating thread by :

    Thread1* obj = new Thread1;
    obj->start();

    And under seperate thread running qfiledialog also causes crash.

    if while(1){} under thread works fine and can get cpu too 100% if start many times.
    How to connect gui and openfiledialog to opengl example?

    Problem is i have made graph app with that example and would be nice to have seperate gui and other gui based elements to configure.
    http://postimg.org/image/wy6eqteh9/


  • Moderators

    Do not show dialogs from worker threads. Ui elements (widgets, dialogs etc.) can live only in the main thread.

    One known issue is showing dialogs from initializeGL function and you shouldn't be doing that if you are.
    Can you show the code opening the dialog?



  • QString filenam;
    filenam = QFileDialog::getOpenFileName(0,"Vali graafiku fail");
    Initialize gl is working in main .cpp file and opening gui crashes always.
    How to run opengl and qt gui same time?


  • Lifetime Qt Champion

    Hi,

    Where exactly are you calling this ?



  • In openglwindow . cpp

              if(e->key() == Qt::Key_5){
    

    filenam = QFileDialog::getOpenFileName(0,"Vali graafiku fail");
    }

    Call from main also cause problems.

    Is only way to make opengl draw from other thread or could use same thread for gui as well?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.