Results 1 to 4 of 4

Thread: While creating custom ToolBar, what should be the "Type Information"

  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default While creating custom ToolBar, what should be the "Type Information"

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: While creating custom ToolBar, what should be the "Type Information"

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    rawfool (28th March 2013)

  4. #3
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: While creating custom ToolBar, what should be the "Type Information"

    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 ?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: While creating custom ToolBar, what should be the "Type Information"

    Yes, it is valid.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    rawfool (6th April 2013)

Similar Threads

  1. Error Message "Paint device returned engine == 0, type:1"
    By yuzhouzhiwai in forum Qt Programming
    Replies: 5
    Last Post: 30th April 2012, 09:33
  2. Replies: 1
    Last Post: 12th October 2010, 14:45
  3. "Treat wchar_t as Built-in Type" to "yes" link error
    By sungaoyong in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 11:45
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. ToolBar with menus and "effects"
    By avis_phoenix in forum Newbie
    Replies: 6
    Last Post: 27th May 2006, 19:48

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.