tags:

views:

61

answers:

1

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?

A: 

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.

Caleb Huitt - cjhuitt
Thanks a lot.What about keeping a pointer variable of QT Widgets classes like QPushbutton in the Nucleus Control class of Button?
Kalpana
@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