Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt and visual Studio extension
ycyclop last edited by
I'm trying to write an extension to VS with Qt and I encountered a problem with mouse events:
The location of the mouse event inside the widget are wrong.
In QtWndProc it calls the function translateMouseEvent. There the global coordinates of the event are transferred to the widget coordinates. The final local pos is done by calling the function QApplicationPrivate::pickMouseReceiver. And the result is in local wrong coordinates
The reason for this is that inside it tries to calculate by looking at the chain of parents of the widget we clicked inside until it reaches a window object. In VS this will not work because from a certain point the parent is no longer a Qt object but a generic HWND object
I create the Qt widget in the CreatePaneWindow which is function in one of VS interfaces that need to be derived if you want to create your own Pane inside VS. I create a QWidget and give it VS supplied HWND as parent using win32 API.
Is there a way to work around this so the correct mouse event location will be calculated?