PDA

View Full Version : While creating custom ToolBar, what should be the "Type Information"



rawfool
28th March 2013, 07:42
I'm creating a custom toolbar with my custom stylesheet, etc. I'll be placing some buttons & a logo on this toolbar.
While creating a new toolbar class, I've given the following details as mentioned below.


Class name: CToolbar
Base class: QToolBar
Type Information: ??

what should I select here. QObject or QWidget or any other? Why do we need "Type Information" if we are mentioning "Base Class"?
So kindly help me understand this. Thank you.

wysota
28th March 2013, 07:46
You shouldn't be subclassing QToolBar at all. It doesn't have any virtual methods that you can reimplement.

But to answer your question -- in this case you should choose QWidget because QToolBar contains QWidget in its inheritance tree.

rawfool
28th March 2013, 08:05
Thank you for replying.
My intention to subclass the QToolBar is that I can have a separate copy of this class with all the custom styling that I've applied. So that can create a object of this in the QMainWindow and add it. Any further changes related to styling or adding/deleting widgets, I can do it in my custom toolbar class so I need not touch QMainWindow.
Is my idea valid ?

wysota
1st April 2013, 14:26
Yes, it is valid.