LabeledSectionGroup Class Reference

A widget containing multiple LabeledSection widgets that provides a common layout in a scroll area. More...

#include <LabeledSectionGroup.h>

List of all members.

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)


Detailed Description

A widget containing multiple LabeledSection widgets that provides a common layout in a scroll area.

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.

See also:
LabeledSection

Definition at line 38 of file LabeledSectionGroup.h.


Constructor & Destructor Documentation

LabeledSectionGroup::LabeledSectionGroup ( QWidget *  pParent = NULL  ) 

Creates an empty labeled section group.

Parameters:
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.


Member Function Documentation

void LabeledSectionGroup::addSection ( LabeledSection pSection,
int  stretch = 0,
Qt::Alignment  alignment = 0 
)

Adds a labeled section to the group.

Parameters:
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().
See also:
addStretch()

void LabeledSectionGroup::addStretch ( int  stretch = 0  ) 

Adds a stretch item to the end of the layout.

Parameters:
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.

Parameters:
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.

Parameters:
pSection The labeled section widget to query for its existance in the group.
Returns:
Returns 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.

Returns:
A vector containing the labeled sections widgets 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.

Parameters:
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.
See also:
hasSection(), LabeledSection::expand()

void LabeledSectionGroup::collapseSection ( LabeledSection pSection  ) 

Collapses a labeled section within the group.

This method visually collapses the labeled section by hiding its section widget.

Parameters:
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.
See also:
hasSection(), LabeledSection::collapse()

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.

Returns:
The preferred size of the group that was set by calling setSizeHint(). If setSizeHint() has not been called, the value returned from the base class QScrollArea::sizeHint() implementation is returned.

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.

Parameters:
pSection The labeled section that was collapsed.
See also:
LabeledSection::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.

Parameters:
pSection The labeled section that was expanded.
See also:
LabeledSection::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&).

Parameters:
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.

Parameters:
size The preferred group size.
See also:
setSizeHint(int, int)


Software Development Kit - Opticks 4.9.0 Build 16218