How can I add a custom button to a QWidget's title bar
Hi
I know this should be possible but after searching for an answer I am still without one. Basically, I have a QMdiArea with a bunch of windows in it. I want to add a custom button (next to the minimize, maximize and close buttons) in the title bar of QMdiSubWindow that allows the user to release the window from the QMdiArea so that it can be shown as a normal widget (almost like undocking a dock widget). When the user click on the buttom again, it should be docked inside the QMdiArea again. I can think of ways to take care of releasing and docking the window. I just want to add a button to the title bar.
I've looked at Qt::WindowFlags but I didn't see anything that looks like what I need.
How can I do this?
Thanks for any inputs.
Jaco
Re: How can I add a custom button to a QWidget's title bar
Afaik this is only possible for QDockWidget, using the setTitleBarWidget method.
Re: How can I add a custom button to a QWidget's title bar
I don't think you can do it without reimplementing QMdiSubWindow internals (handling paintEvent and mouse{Press,Release}Event at least).
Re: How can I add a custom button to a QWidget's title bar
Hi
Thanks for the responses. Seems like the easiest way to go forward would be to add a context menu giving the user the same option/functionality.
Too bad its not possible (easily)
Thanks again,
Jaco
Re: How can I add a custom button to a QWidget's title bar
Dear JPNaude:
I am very interested in your idea about how to dock the QMdiSubWindow.
Could you please tell me more details?
Thanks a lot!