I'm just having trouble coming to grips with this issue. At the moment, I'm trying to figure out how to implement a widget base class that can be sub-classed by either a QWidget-based class or a QGLWidget-based class. I can't figure out how to implement such a structure
. Here's the problem:
.
+-----------------+
| Abstract Base |
| Class |
+-----------------+
/ \
/ \
/ \
/ \
+-----------------+ +------------------+
| QWidget-based | | QGLWidget-based |
| class | | class |
+-----------------+ +------------------+
.
+-----------------+
| Abstract Base |
| Class |
+-----------------+
/ \
/ \
/ \
/ \
+-----------------+ +------------------+
| QWidget-based | | QGLWidget-based |
| class | | class |
+-----------------+ +------------------+
To copy to clipboard, switch view to plain text mode
The abstract base class would include signals and slots that its sub-classes would implement. This creates a problem. If I were to say that the abstract base class inheritted QWidget, I can make the QWidget subclass work, but not the QGLWidget. If I were to say that the abstract base class inheritted QGLWidget, I can make the QGLWidget subclass work, but not the QWidget subclass. If I were to simply make the abstract base class inherit QObject, neither would work. Any idea how to resolve such a thing?
I can't get rid of all reference to a QObject ancestor because I require the virtual signals and slots inherittance.
Bookmarks