PDA

View Full Version : QtWinMigrate not working with Qt5



Al W
13th October 2014, 08:45
I am having trouble upgrading a Qt GUI DLL to Qt5.3 from Qt4.8. We are using QtWinMigrate to load the DLL from a Win32 application. We are unable to change the Win32 app. The problem we are seeing is the same that is mentioned in this thread:

http://qt-project.org/forums/viewthread/30038

i.e. that all the GUI elements are completely unresponsive, e.g. buttons can't be clicked.

The issue is taken up by the author of this thread in this bug report:
https://bugreports.qt-project.org/browse/QTBUG-32962

The bug was marked as closed because the author believed it was fixed. This is not the case as in another thread here:

http://lists.qt-project.org/pipermail/development/2013-December/014592.html

the author mentions he had a local work around in place when he stated that it was fixed.
The issue seems to be that


void QWindowsGuiEventDispatcher::sendPostedEvents()
{
QCoreApplication::sendPostedEvents();
QWindowSystemInterface::sendWindowSystemEvents(m_f lags);
}


is not called, but the base class


void QEventDispatcherWin32::sendPostedEvents()
{
Q_D(QEventDispatcherWin32);
QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
}


which doesn't send windows events. It's called from qt_internal_proc in qeventdispatcher_win.cpp.
The pointer to the dispatcher is a static cast from a GetWindowLongPtr, so as far as I can see it will always call the base class.

It can sort of be made to work by hacking QtFilterProc in qmfcapp.cpp to add the line


QWindowSystemInterface::sendWindowSystemEvents(QEv entLoop::AllEvents);


but it is slow and some bits. e.g. combo boxes, still do not work.

So are there any ideas how to go about fixing this? Or are there any workarounds? The architecture of the controlling application means we can't start an event loop in another thread, though this could be a workaround in other cases.

We are using VS2013, Qt 5.3.2.