Qt World Summit: Register Today!

QEvents and nativeEvents in Dll created widgets

  • The problem I am having is very specific, but I still hope that someone here can help me.

    I have the following situation: We want to provide QWidgets via Dll in an application (win32) that is not using Qt.

    The steps I am doing to achieve this are,

    1. In my DllMain I start a new Thread, which runs QApplication::exec
    2. There is a function in the Dll which will create a QWidget. To do this I send an event to the QApplicationthread, which will then create the widget

    If I use the external application the widget is indeed created (as a floating window, which is okay for now), BUT the widget is not reacting to user input: If I use a QPushButton, the button is not pressed by clicking on it, etc.

    First I thought, that the messages simply do not arrive at the widget, but the curious part is, that they do:
    When I overload the "nativeEvent" function, the widget receives all windows messages just fine.
    For me it seems that the windows messages are simply not translated to QEvents

    As a second test I tried installing an nativeevent filter for my qapplication, I never end up in this function, when clicking on the button.

    Edit: Btw, resizing the widget and moving it works just fine!

Log in to reply