#include <LabeledSectionGroup.h>
Signals | |
| void | sectionCollapsed (LabeledSection *pSection) |
| void | sectionExpanded (LabeledSection *pSection) |
Public Member Functions | |
| LabeledSectionGroup (QWidget *pParent=NULL) | |
| ~LabeledSectionGroup () | |
| void | addSection (LabeledSection *pSection, int stretch=0, Qt::Alignment alignment=0) |
| void | addStretch (int stretch=0) |
| void | removeSection (LabeledSection *pSection) |
| bool | hasSection (LabeledSection *pSection) const |
| std::vector< LabeledSection * > | getSections () const |
| void | expandSection (LabeledSection *pSection) |
| void | collapseSection (LabeledSection *pSection) |
| void | clear () |
| QSize | sizeHint () const |
Protected Member Functions | |
| void | setSizeHint (int width, int height) |
| void | setSizeHint (const QSize &size) |
This widget subclasses QScrollArea and organizes multiple LabeledSection widgets in a QVBoxLayout. Sections are added with optional parameters that would normally be passed into a QVBoxLayout when adding child widgets. Each section in the layout contains extra spacing to make it easier to visually separate the sections.
For size purposes, each LabeledSection can be expanded or collapsed to display the entire section widget or just its header label. For adjacent sections, call addSection() with a very large stretch value (e.g.: 1000) for each section followed by addStretch() with a relatively small value (e.g.: 1) to obtain optimal results.
Definition at line 38 of file LabeledSectionGroup.h.
| LabeledSectionGroup::LabeledSectionGroup | ( | QWidget * | pParent = NULL |
) |
Creates an empty labeled section group.
| pParent | The parent widget for the group. |
| LabeledSectionGroup::~LabeledSectionGroup | ( | ) |
Destroys the labeled section group.
When the group is destroyed, all labeled section widgets contained in the group are also destroyed. Call clear() prior to destroying the group to take ownership of the section widgets.
| void LabeledSectionGroup::addSection | ( | LabeledSection * | pSection, | |
| int | stretch = 0, |
|||
| Qt::Alignment | alignment = 0 | |||
| ) |
Adds a labeled section to the group.
| pSection | The labeled section widget to add to the group. This method does nothing if NULL is passed in. | |
| stretch | The stretch factor to assign to the added section. The stretch factor is passed into QVBoxLayout::addWidget(). | |
| alignment | The layout alignment to assign to the added section. The alignment is passed into QVBoxLayout::addWidget(). |
| void LabeledSectionGroup::addStretch | ( | int | stretch = 0 |
) |
Adds a stretch item to the end of the layout.
| stretch | The stretch factor to add to the layout. The stretch factor is passed into QVBoxLayout::addStretch(). |
| void LabeledSectionGroup::removeSection | ( | LabeledSection * | pSection | ) |
Removes a labeled section from the group.
This method removes the section from the group but does not delete it. Ownership is transferred to the calling object.
| pSection | The labeled section widget to remove from the group. This method does nothing if NULL is passed in or if the given section does not exist in the group. |
| bool LabeledSectionGroup::hasSection | ( | LabeledSection * | pSection | ) | const |
Queries whether a labeled section exists in the group.
| pSection | The labeled section widget to query for its existance in the group. |
true if the group contains the given labeled section; otherwise returns false. | std::vector<LabeledSection*> LabeledSectionGroup::getSections | ( | ) | const |
Returns all labeled sections contained in the group.
| void LabeledSectionGroup::expandSection | ( | LabeledSection * | pSection | ) |
Expands a labeled section within the group.
This method visually expands the labeled section by showing its section widget.
| pSection | The labeled section widget to expand. This method does nothing if NULL is passed in or if the given section does not exist in the group. |
| void LabeledSectionGroup::collapseSection | ( | LabeledSection * | pSection | ) |
Collapses a labeled section within the group.
This method visually collapses the labeled section by hiding its section widget.
| pSection | The labeled section widget to collapse. This method does nothing if NULL is passed in or if the given section does not exist in the group. |
| void LabeledSectionGroup::clear | ( | ) |
Removes all sections and spacer items from the layout.
This method removes all sections from the group but does not delete them. Ownership for all section widgets is transferred to the calling object.
| QSize LabeledSectionGroup::sizeHint | ( | ) | const |
Returns the preferred size of the group.
| void LabeledSectionGroup::sectionCollapsed | ( | LabeledSection * | pSection | ) | [signal] |
Emitted when one of the contained section widgets is hidden.
This signal is emitted when one of the contained section widgets is hidden either programmatically by calling collapseSection() or when the user clicks the collapse indicator (-) next to the header text.
| pSection | The labeled section that was collapsed. |
| void LabeledSectionGroup::sectionExpanded | ( | LabeledSection * | pSection | ) | [signal] |
Emitted when one of the contained section widgets is shown.
This signal is emitted when one of the contained section widgets is hidden either programmatically by calling expandSection() or when the user clicks the expand indicator (+) next to the header text.
| pSection | The labeled section that was expanded. |
| void LabeledSectionGroup::setSizeHint | ( | int | width, | |
| int | height | |||
| ) | [protected] |
Sets the preferred size of the group.
This is a convenience method that creates a QSize from the given width and height and calls setSizeHint(const QSize&).
| width | The preferred group width. | |
| height | The preferred group height. |
| void LabeledSectionGroup::setSizeHint | ( | const QSize & | size | ) | [protected] |
Sets the preferred size of the group.
This method sets a custom preferred size of the group widget that may need to be called based on the contents of the labeled sections contained in the group.
| size | The preferred group size. |