Frage

I'm working with a TabWidget that allow users to 'drag out' its tab to be a new top-level widget.(i.e. make the tab floatable)

When a tab is dragged, I get the content (i.e. the target widget, we call it tar_widget) and remove the original tab, then construct a new top-level widget, put the tar_widget into a new layout, and assign the layout to the new-created widget.

I want the tar_widget to be shown into the new-created widget but actually not.

I already did the homework that QTabWidget consists of a QTabBar and a QStackedWidget, I also tried that reset the parent of the tar_widget and remove the layout which it used to belong, however the problem still exists.

I hope someone would tell me if i did something wrong.

War es hilfreich?

Lösung

I finally noticed that the tar_widget was a QGLWidget, That was the problem.

I've learned that the QGLWidget would attach an openGL context, as I moved it into another widget, the context could not move to the new parent widget(on Windows), as the document said.

The solution is to use a dummy widget as the parent of tar_widget and move the dummy widget into another widget.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top