Geoffroy
Geoffroy

Reputation: 1081

Drag and drop of QDockWidget between two or more windows

I would like to know if anybody knows if it is possible to drag a QDockWidget from one window to another.

I am developping an application that has a lot of windows. Each of these windows has a specific usage. I want to use QDockWidget because of the automatic rescaling when docking a widget in the main window. But I would also like to have the possibility to have a new dock area in a new window so that I can put together all the widgets related one to each other.

Does anyone have a suggestion?

Upvotes: 2

Views: 2460

Answers (1)

felixgaal
felixgaal

Reputation: 2423

As far as I know, you cannot drag a QDockWidget from one application to another if they are developed separately.

On the other hand, I think that you can reparent a QDockWidget to another QMainWindow, only if it's part of the same application.

...aaaaand you can always try to intercept the drap/drop events and pass information between the two windows with a protocol of your own: define a new mime type for the drag and define the syntax of the data associated to the QDockWidget. Then, implement the code to analyze the data and reconstruct the contents of the QDockWidget in the target window... not an easy task!

Upvotes: 5

Related Questions