Note that there are some explanatory texts on larger screens.

plurals
  1. POPorting threads from QT3 to QT4
    primarykey
    data
    text
    <p>I am porting an application from QT3 to QT4, and keep running into problems when a thread is updating a QProgressDialog. The original code was roughly designed like so:</p> <pre><code>class ScanProcess : QObject{ Q_OBJECT public: QProgressDialog* progress; private: ScanProcessThread* thread; }; class ScanProcessThread : QThread { Q_OBJECT public: void run(); }; </code></pre> <p>This is after running qt3to4 and making the appropriate changes from the QT Porting guide.</p> <p>In the original design, inside the ScanProcessThread:</p> <pre><code>void ScanProcessThread::run(){ //... ProgressInfo *prog = new ProgressInfo(); //then fill it in QCustomEvent* progEvent = new QCustomEvent(QEvent::User+1, (void*)prog); QCoreApplication::postEvent(parent, progEvent);//Parent is pointer to the ScanProcess //... } void ScanProcess::customEvent(QCustomEvent *e){ if(e-&gt;type() == QEvent::User+1){ //update QProgressDialog progres-&gt;setValue(prog.index);//Value from the ProgressInfo passed above //This line crashes deep in ntdll, but I have traced it to the QProgressDialog::repaint() } } struct ProgressInfo {int count; int index; QString text;}; </code></pre> <p>So, that's the important code. The call to QProgressDialog::Repaint seems to always crash somewhere deep in ntdll. I have tried two other methods: 1) Use QCoreApplication::postEvent() 2) Pass the QProgressDialog* and let ScanProcessThread update it directly. In every case, it's the QProgressDialog::repaint() that fails. Any ideas?</p> <p>(qt4.4, windows xp sp3, Visual Studio 2008/)</p>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
 

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