Results 1 to 2 of 2

Thread: Create "QGroupBoxCollapsible" - best approach?

  1. #1
    Join Date
    Feb 2006
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Create "QGroupBoxCollapsible" - best approach?

    Hi All

    I wish to create a widget which does everything QGroupBox does except is does not have 'Checkable' but has a button (+/-) in the the title area that when clicked on collapses/shrinks the widget to show just the title hiding any child widgets. What is the best approach? Looking at the QGroupBox code I need to derived my new widget direct from QWidget, not QGroupBox. However do I need to use QWidgetPrivate derived class too (private to me for a reason?)? What is the purpose of this class exactly? If a do use it what kind of functionality should it hold that would not be suitable to be containing in class QGroupBoxCollapsible : public QWidget?

    Thanks
    Cya Illya

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Create "QGroupBoxCollapsible" - best approach?

    Quote Originally Posted by irudkin View Post
    I wish to create a widget which does everything QGroupBox does except is does not have 'Checkable' but has a button (+/-) in the the title area that when clicked on collapses/shrinks the widget to show just the title hiding any child widgets. What is the best approach?
    1) subclass QGroupBox
    2) show/hide children according to QGroupBox::toggled(bool)
    3) use style sheets (::indicator subcontrol) to style the check indicator

    Looking at the QGroupBox code I need to derived my new widget direct from QWidget, not QGroupBox. However do I need to use QWidgetPrivate derived class too (private to me for a reason?)? What is the purpose of this class exactly?
    It's called pimpl.
    J-P Nurmi

Similar Threads

  1. Create QTextStream
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2007, 20:25
  2. dynamically create folders with QT
    By eleanor in forum Newbie
    Replies: 3
    Last Post: 13th March 2007, 11:40
  3. how to create resource fork & data fork
    By jyoti in forum General Discussion
    Replies: 4
    Last Post: 28th November 2006, 17:20
  4. Replies: 1
    Last Post: 24th October 2006, 16:40
  5. How to create an Insert/Submit button for a form.
    By fnmblot in forum Qt Programming
    Replies: 5
    Last Post: 4th August 2006, 16:18

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.