Important: Please read the Qt Code of Conduct -

When a dock widget is floating, how to reset it back to its initial area when a button is pressed?

  • Hello everyone, hope all is well! Currently I want to create a function that moves all dock widgets back to their initials places if a certain button is pressed. I am currently using the isFloating method to detect if the dock is not in its initial area. However, I am still trying to figure out how to have the program place the dock back in its initial dockWidgetArea when the button is pressed. Any advice on how to do this?

  • Lifetime Qt Champion


    One way would be to store that information when your application starts or ends for the next usage and then reload that configuration.

  • @SGaist Would I be able to save multiple configurations?

  • Lifetime Qt Champion

    Well, I don't see a reason why you couldn't. Implement the saving part in such a way. You can use a key value approach with the name of the "layout configuration" as a key and your widgets configuration as the value.

Log in to reply