Take the 2-minute tour ×

I am trying to port/re-write GUI made using Nucleus Grafix to QT on Linux.In Nucleus code there is a control class which is the base class for the rest of the controls like Button,Editbox, radiobutton etc.This base class uses Nucleus API's and control structs to maximum.My question is whether to port/re-write the base class or make the control classes like Button to inherit from QPushButton.Which is better?

share|improve this question

1 Answer 1

Oftentimes for a situation like this, it is easier to do dual-inheritence. It may not be the best long-term solution, but it will probably get you to your desired result the fastest. Remember that the QObject-derived class has to be the first one inherited from, and to avoid diamond inheritance with QObjects.

share|improve this answer
Thanks a lot.What about keeping a pointer variable of QT Widgets classes like QPushbutton in the Nucleus Control class of Button? –  Kalpana Nov 16 '09 at 11:01
@Kalpana: Not knowing anything about Nucleus, I would say that you probably could do so. You'll need to be careful about object ownership if you give your classes like QPushButton a parent, but maintain a pointer to it in another class. –  Caleb Huitt - cjhuitt Nov 17 '09 at 3:01

Your Answer


