Moussa Ball
Moussa Ball

Reputation: 57

Drag and Drop a toolbox like photoshop

I'm developing a multi platform application windows, mac and linux and I need yours to know how to have the same effect of drag and drop of photoshop on qt, that is to say how can I do to have the same aspect of moving a toolbox and depositing it on a corner of my main window. I do not need qtoolbar, I want my own implementation.

Photoshop effect example

Upvotes: 0

Views: 123

Answers (1)

Jared G
Jared G

Reputation: 1638

I've done similar work in other languages and frameworks. If you want to roll your own from scratch my #1 advice is to break the problem up into smaller parts and take it on progressively.

  1. Write or import a good drag drop handler
  2. Handle dragging around to position a free floating "toolbox" (no docking yet)
  3. Create logic to detect dropping on to "hot zones" (areas of a set width at the edges of the screen) to initiate a dock
  4. Handle the behavior of a panel in the "docked" state (locked to left x coordinate, etc)
  5. Jazz it up with drawing cues to indicate to the user where a panel will dock as it is dragged.
  6. Keep building the logic for nested panels, tabbed panels, etc. Try to tackle it in an object oriented way to keep the code clean and tight and promote reuse.

You may want to start by studying some other implementations, regardless of language to get some ideas and see how they setup the logic.

A Qt4 docking framework

A JS docking framework

A c# docking framework

Good luck!

Upvotes: 1

Related Questions