LabeledSection Class Reference

Used to organize complex widgets into smaller sections. More...

#include <LabeledSection.h>

List of all members.

Public Slots

void collapse ()
void expand ()

Signals

void collapsed ()
void expanded ()

Public Member Functions

 LabeledSection (QWidget *pParent=NULL)
 LabeledSection (const QString &text, QWidget *pParent=NULL)
 LabeledSection (QWidget *pSectionWidget, const QString &text, QWidget *pParent=NULL)
 ~LabeledSection ()
QString getText () const
void setText (const QString &newText)
QWidget * getSectionWidget () const
void setSectionWidget (QWidget *pNewSectionWidget)

Protected Member Functions

bool eventFilter (QObject *pObject, QEvent *pEvent)
void mousePressEvent (QMouseEvent *pEvent)
void mouseDoubleClickEvent (QMouseEvent *pEvent)


Detailed Description

Used to organize complex widgets into smaller sections.

This widget should be used within complex layouts which have logical sections which can be split up. By placing each section within a labeled section, a these complex widgets can have a consistent appearance throughout the application.

When a section widget is added, an expand/collapse indicator appears in the header next to the text label. When the user clicks on the indicator the section widget is shown or hidden, giving the appearance of expanding or collapsing the labeled section. This is especially useful when multiple labeled sections are contained in a LabeledSectionGroup, which provides a common layout in a scroll area.

See also:
setSectionWidget()

Definition at line 35 of file LabeledSection.h.


Constructor & Destructor Documentation

LabeledSection::LabeledSection ( QWidget *  pParent = NULL  ) 

Creates a labeled section with no header text and no section widget.

Parameters:
pParent The parent widget.

LabeledSection::LabeledSection ( const QString &  text,
QWidget *  pParent = NULL 
)

Creates a labeled section with header text but no section widget.

This constructor may be used to create a simple separator between other widgets. With no section widget, the expand/collapse indicator is not shown.

Parameters:
text The text to dispay in the header.
pParent The parent widget.

LabeledSection::LabeledSection ( QWidget *  pSectionWidget,
const QString &  text,
QWidget *  pParent = NULL 
)

Creates a labeled section with header text and a section widget.

Parameters:
pSectionWidget The widget to display below the header. When a valid section widget is given, the widget is shown and the labeled section assumes ownership of the new section widget. The labeled section will delete the section widget when the labeled section itself is deleted.
text The text to dispay in the header.
pParent The parent widget.

LabeledSection::~LabeledSection (  ) 

Destroys the labeled section and the section widget.


Member Function Documentation

QString LabeledSection::getText (  )  const

Returns the header text.

Returns:
The header text.
See also:
setText()

void LabeledSection::setText ( const QString &  newText  ) 

Sets the text in the header.

Parameters:
newText The new text to use in the header.
See also:
getText()

QWidget* LabeledSection::getSectionWidget (  )  const

Returns the contained section widget.

Returns:
The contained section widget, which may be NULL.
See also:
setSectionWidget()

void LabeledSection::setSectionWidget ( QWidget *  pNewSectionWidget  ) 

Sets the contained section widget.

If the widget already contains a section widget, the parent of the old section widget is set to NULL and the widget is not deleted. The caller of this function then assumes ownership of the old section widget and is responsible for deleting it.

When a valid section widget is given, an expand/collapse indicator appears in the header next to the text label. When the user clicks on the indicator the section widget is shown or hidden, giving the appearance of expanding or collapsing the labeled section.

Parameters:
pNewSectionWidget The new section widget to display. The labeled section assumes ownership of the new section widget and will delete the section widget when the labeled section itself is deleted.
See also:
getSectionWidget()

void LabeledSection::collapse (  )  [slot]

Collapses the section widget to show just the header.

If the widget does not have a section widget, this method does nothing.

void LabeledSection::expand (  )  [slot]

Expands the section widget to show both the header and the section widget.

If the widget does not have a section widget, this method does nothing.

void LabeledSection::collapsed (  )  [signal]

Emitted when the section widget is hidden.

This signal is emitted when the section widget is hidden either programmatically by calling collapse() or when the user clicks the collapse indicator (-) next to the header text.

void LabeledSection::expanded (  )  [signal]

Emitted when the section widget is shown.

This signal is emitted when the section widget is shown either programmatically by calling expand() or when the user clicks the expand indicator (+) next to the header text.

bool LabeledSection::eventFilter ( QObject *  pObject,
QEvent *  pEvent 
) [protected]

Emits the collapsed() and expanded() signals when the section widget is hidden or shown.

By default, when the labeled section contains a section widget, an event filter is installed on the section widget to emit either the collapsed() or expanded() signal. If another event filter is installed on the labeled section and the given object is not the section widget, this method is just a pass-through to the default QWidget implementation.

Parameters:
pObject The object prompting the event.
pEvent The event invoked by the object.
Returns:
Returns the value returned by the default QWidget implementation.

void LabeledSection::mousePressEvent ( QMouseEvent *  pEvent  )  [protected]

Expands or collapses the section widget.

This method is called by Qt when the user clicks inside the section widget. If the user clicked on the expand/collapse indicator in the header, the section is shown or hidden and the expanded() or collapsed() signal is emitted accordingly.

Parameters:
pEvent The mouse event associated with the mouse press.

void LabeledSection::mouseDoubleClickEvent ( QMouseEvent *  pEvent  )  [protected]

Expands or collapses the section widget.

This method is called by Qt when the user double clicks inside the section widget. If the user clicked on the header text or the horizontal line, the section is shown or hidden and the expanded() or collapsed() signal is emitted accordingly.

Parameters:
pEvent The mouse event associated with the mouse double click.


Software Development Kit - Opticks 4.9.0 Build 16218