Is there any way to access classes defined in a platform plug-in?
-
I'm working on an open-source macOS Qt plug-in that translates touch screen input into Qt mouse and touch events. Unfortunately I've hit a snag due to the way dragging is implemented in the Qt cocoa platform plug-in, which causes drag and drop behavior to go wrong with the events I'm generating.
Without going into too much detail, the issue is that the mouse and touch events I'm generating are not registered as the last mouse event to use for a drag-and-drop operation, and therefore the drag starts from the wrong point on screen.
Basically, what I need to do to fix it is access the function
QCocoaDrag::setLastMouseEvent()
and call it with the events I'm generating. But I can't find any way of getting at it. Maybe this isn't possible?I can get access to a pointer to the instance of it using:
QPlatformDrag *drag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
...but the Cocoa plugin headers are not distributed with Qt's macOS frameworks, and only seem to be available in the Qt source code itself.
Is there any supported way to get at this class?
-
I'm working on an open-source macOS Qt plug-in that translates touch screen input into Qt mouse and touch events. Unfortunately I've hit a snag due to the way dragging is implemented in the Qt cocoa platform plug-in, which causes drag and drop behavior to go wrong with the events I'm generating.
Without going into too much detail, the issue is that the mouse and touch events I'm generating are not registered as the last mouse event to use for a drag-and-drop operation, and therefore the drag starts from the wrong point on screen.
Basically, what I need to do to fix it is access the function
QCocoaDrag::setLastMouseEvent()
and call it with the events I'm generating. But I can't find any way of getting at it. Maybe this isn't possible?I can get access to a pointer to the instance of it using:
QPlatformDrag *drag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
...but the Cocoa plugin headers are not distributed with Qt's macOS frameworks, and only seem to be available in the Qt source code itself.
Is there any supported way to get at this class?
@Guy-Gizmo said in Is there any way to access classes defined in a platform plug-in?:
Maybe this isn't possible?
It is, but you will have to modify the plug-in code and rebuild it.
-
@Guy-Gizmo said in Is there any way to access classes defined in a platform plug-in?:
Maybe this isn't possible?
It is, but you will have to modify the plug-in code and rebuild it.
@jsulm said in Is there any way to access classes defined in a platform plug-in?:
@Guy-Gizmo said in Is there any way to access classes defined in a platform plug-in?:
Maybe this isn't possible?
It is, but you will have to modify the plug-in code and rebuild it.
Can you clarify what you mean? Do you mean the Qt cocoa platform plug-in needs to be recompiled, or the plug-in I'm working on needs to be recompiled? And what does it need to be recompiled to do?
-
@jsulm said in Is there any way to access classes defined in a platform plug-in?:
@Guy-Gizmo said in Is there any way to access classes defined in a platform plug-in?:
Maybe this isn't possible?
It is, but you will have to modify the plug-in code and rebuild it.
Can you clarify what you mean? Do you mean the Qt cocoa platform plug-in needs to be recompiled, or the plug-in I'm working on needs to be recompiled? And what does it need to be recompiled to do?
@Guy-Gizmo Since it is a plugin, it may not be loaded if it is not needed. Maybe try to make sure it is loaded or your app loads it. And add all include files into your app.
https://doc.qt.io/qt-6/qpluginloader.html -
@Guy-Gizmo Since it is a plugin, it may not be loaded if it is not needed. Maybe try to make sure it is loaded or your app loads it. And add all include files into your app.
https://doc.qt.io/qt-6/qpluginloader.html@JoeCFD Yes, my plug-in is only intended to be used on macOS, in which case the host app will surely be using the Cocoa platform plug-in. And if the off chance it's not then my plug-in won't attempt to use anything from the Cocoa plug-in.
So it looks like what I'd need to do is include the QCocoaDrag header files from the various different versions of the Qt source code. Is that right? (Am I allowed to distribute that if my plug-in is open source?)