Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you've moved all the <code>Model</code> stuff into <code>GLWidget</code> then I assume you are now creating your <code>GLWidget</code> instance in <code>::loadModel</code>? If so then be aware that this is being created in a new thread. It looks like it doesn't automatically get moved into the main (GUI) thread when the loading thread finishes. What actually happens to the QObject is <a href="https://stackoverflow.com/questions/5383296/what-happens-to-the-thread-affinity-of-a-qobject-created-within-a-worker-thread/8957696#8957696">an open question</a>.</p> <p>If you want to disable threading completely in order to simplify things then remove the lines</p> <pre><code>#ifndef QT_NO_CONCURRENT #include &lt;QFutureWatcher&gt; #endif </code></pre> <p>and</p> <pre><code>#ifndef QT_NO_CONCURRENT QFutureWatcher&lt;Model *&gt; m_modelLoader; #endif </code></pre> <p>in openglscene.h. In the OpenGLScene constructor body remove the lines</p> <pre><code>#ifndef QT_NO_CONCURRENT connect(&amp;m_modelLoader, SIGNAL(finished()), this, SLOT(modelLoaded())); #endif </code></pre> <p>In <code>OpenGLScene::loadModel(const QString &amp;filePath)</code> change</p> <pre><code>#ifndef QT_NO_CONCURRENT m_modelLoader.setFuture(QtConcurrent::run(::loadModel, filePath)); #else setModel(::loadModel(filePath)); modelLoaded(); #endif </code></pre> <p>to just</p> <pre><code> setModel(::loadModel(filePath)); modelLoaded(); </code></pre> <p>Finally remove</p> <pre><code>#ifndef QT_NO_CONCURRENT setModel(m_modelLoader.result()); #endif </code></pre> <p>from <code>OpenGLScene::modelLoaded()</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COWell, as I understand it, it is not possible to load obj-files as I tried to do. I have tried to push my object into the main-thread but it isnt working. I am a complete newbie to threading. I have researched a little bit on this matter, but I cant get a grip on this. The whole concept of threading seems to be a BIG thing. Might there be another way to load obj.-files? Maybe without threading. From your answer I get the feeling that there might be a possibility. Could you be more specific? Thank you.
      singulars
    2. CO@buddy: You can certainly remove the threading easily enough as there are two code paths wherever the threading is used. Which one is compiled in is dependent on the QT_NO_CONCURRENT preprocessor macro. Either ensure that this macro is defined at the top of the relevant source files or just comment out the threading code (which is in the `ifndef QT_NO_CONCURRENT` bits). Try this and see if it works. If you want to get it working with threading let me know and I can see what I can do.
      singulars
    3. COActually Qt seem to have another problem.I have removed the threading from the unchanged sourcecode.(Where i still have the model class).This is working fine. As soon as I add to the Model class `: public QGLWidget` I get the error: It is not safe to use pixmaps outside the GUI thread. So it seems to be rather the inheritance in general than the threading. And the inheritance I need in GLWidget Do you know why that might be?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload