2
votes

I have a few different QGlWidget based display widgets which I need to embed in either an MDI or QDockwidget based app. But I need to handle some of the MDI/Dock specific events (minimize/dock etc) in my display widget

Options are:
Multiply inherit the display widgets from QGlWidget and QMdiSubWindow/QDockWidget. Any issues with multiply inheriting and signals/slots?

Encapsulate the display inside a QMdiSubWindow/QDock derived widget but then I have to wrap all the display's external functions in the Mdi/Dock wrapper widget.

When I make a new window, create a temporary Mdi/Dock widget, connect all the special signals to slots in the display before attaching the display to it and showing it. But this doesn't work for events.

Some QSignalMapper magic where I can receive QMdiSubWindow/QDockWidget specific signals in a QGlWidget

1
Qt doesn't support inheriting from QObject twice in the same object, so assuming that QGIWidget is a subclass of QWidget, your first option isn't going to work...Jeremy Friesner
@JeremyFriesner - thanks, I thought it didn't workMartin Beckett

1 Answers

2
votes

MDI/dock widgets are containers for other widgets, so mixing their features with display widgets is not a very nice solution as you end up with a hideous hybrid widget that looks like a container - but cannot contain anything. Not that Qt would allow it as noted by Jeremy.

If your QGLWidget needs events from it's parent container (e.g. minimize, dock, etc.) why can't you create partner methods in the QGLWidget for them, and call them whenever the action is performed by the parent?