简体   繁体   中英

Qt Drag'n'Drop application window(s) – similar to browser tabs

The task at hand is implementing a drag and drop handler that allows to drag an element either

  • between windows
  • outside a window

The desired behavior is like that of browser tabs: By pulling a tab from one browser window to another the tab can be moved between the windows. Pulling the tab out of a window creates a new browser window with that tab opened.

I'd like to replicate this in my program.

I see several possibilities implementing this manually, however is there some easy way to implement this with the batteries included in Qt?

afaik there is no such 'one-liner' to get this behaviour.

one approach would be that your application stores all needed information about the tab in the clipboard, and knows how to interpret this information to create the new tab (in the 2nd instance).

another approach would be (when i think of firefox, but i dont know how they handle it) to use shared memory and share this pointer between your instances (but i do not know if this is considered 'safe')

cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM