Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is there any way to access classes defined in a platform plug-in?
Forum Updated to NodeBB v4.3 + New Features

Is there any way to access classes defined in a platform plug-in?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 327 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Guy GizmoG Offline
    Guy GizmoG Offline
    Guy Gizmo
    wrote on last edited by
    #1

    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?

    jsulmJ 1 Reply Last reply
    0
    • Guy GizmoG Guy Gizmo

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Guy GizmoG 1 Reply Last reply
      0
      • jsulmJ jsulm

        @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 GizmoG Offline
        Guy GizmoG Offline
        Guy Gizmo
        wrote on last edited by Guy Gizmo
        #3

        @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?

        JoeCFDJ 1 Reply Last reply
        0
        • Guy GizmoG Guy Gizmo

          @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?

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          @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 GizmoG 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @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 GizmoG Offline
            Guy GizmoG Offline
            Guy Gizmo
            wrote on last edited by
            #5

            @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?)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved