[Interest] Dragging between separate windows in Qml

manish sharma 83.manish at gmail.com
Thu Apr 10 08:29:17 CEST 2014


just found a trick on how to get the cursor position while external drag is
active. I have not tried this approach but it might work. Please check
below link. Its a hack though.

http://stackoverflow.com/questions/7585182/slow-repaint-underneath-dragged-object-on-x-can-qt-force-drag-and-drop-operat

Similar thing you can do in Qml, start a timer and follow your mouse base
on QCursor::pos().


On Wed, Apr 9, 2014 at 3:52 PM, manish sharma <83.manish at gmail.com> wrote:

> And about moving the window while mouse is being moved while in external
> drag is not possible as startDrag starts a different event loop.
>
> About the question on setting a pixmap for Drag attached property i have
> raised a jira ticket https://bugreports.qt-project.org/browse/QTBUG-37366and so far response has been quite slow :(
>
>
>
>
> On Wed, Apr 9, 2014 at 1:47 PM, Paweł Pietraszko <
> pawel.jan.pietraszko at gmail.com> wrote:
>
>> Hi!
>>
>> I am trying to accomplish dragging objects beetween QML windows. So far I
>> have created my own tab view with draggable tabs (beetwen other tab views).
>> Now I want to implement the possibility to drag tabs out to separate
>> windows and putting windows back as tabs.
>>
>> Ideally, object after being dragged from its dock should transform into a
>> Window which I would be able to drag and release outside of the current
>> window (creating a new one) or drop in other dock in the same window --
>> creates object (in my case tab).
>>
>> I managed to create a new Window after dragging the tab out from the
>> dock. Then I can dock it back in the same window without releasing the
>> mouse, or just drop it outside (so the new window now exists separately).
>> To achieve this I had to create my own Window derived from QQuickWindow and
>> expose requestActivation function to Qml. You must call it when dragging
>> out tab. Otherwise, the new window activates itself, stealing focus and
>> events.
>>
>> But after that I bumped into a few problems:
>> 1. I cannot dock the object (being dragged) in any other window than the
>> active one. Changing the active window stops the movement of my dragged
>> window.
>> 2. I cannot dock the Window in a dock area of another Window.
>>
>> A solution to this could be to manually start the drag -- by using
>> startDrag() at Drag attached object of the dragged object (wicked drags!).
>> But I cannot make the Window or the object to move as mouse moves. So I
>> managed to only implement a drag without the object following the mouse
>> (different cursor icon is the only visual indicator of the drag process).
>>
>> Eventually if dragging entire window is not possible maybe it's possible
>> to set a pixmap for a drag (that will folow the mouse). I have seen that
>> QDrag object (in C++ API) can have the pixmap set, however such possiblity
>> seems to not be exposed to Qml.
>>
>> Cheers,
>> Paweł
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140410/33634b1c/attachment.html>


More information about the Interest mailing list