CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Properties | List of all members
ctkCollapsibleButton Class Reference

#include <Libs/Widgets/ctkCollapsibleButton.h>

Inheritance diagram for ctkCollapsibleButton:
Inheritance graph
[legend]
Collaboration diagram for ctkCollapsibleButton:
Collaboration graph
[legend]

Signals

void contentsCollapsed (bool)
 

Public Member Functions

Qt::Alignment buttonTextAlignment () const
 
bool collapsed () const
 
int collapsedHeight () const
 
QFrame::Shadow contentsFrameShadow () const
 
QFrame::Shape contentsFrameShape () const
 
int contentsLineWidth () const
 
int contentsMidLineWidth () const
 
 ctkCollapsibleButton (const QString &text, QWidget *parent=0)
 
 ctkCollapsibleButton (QWidget *parent=0)
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *child, QEvent *e)
 
Qt::Alignment indicatorAlignment () const
 
bool isFlat () const
 
virtual QSize minimumSizeHint () const
 
void setButtonTextAlignment (Qt::Alignment textAlignment)
 
void setCollapsed (bool)
 
void setCollapsedHeight (int heightInPixels)
 
void setContentsFrameShadow (QFrame::Shadow)
 
void setContentsFrameShape (QFrame::Shape)
 
void setContentsLineWidth (int)
 
void setContentsMidLineWidth (int)
 
void setFlat (bool flat)
 
void setIndicatorAlignment (Qt::Alignment indicatorAlignment)
 
virtual void setVisible (bool)
 
virtual QSize sizeHint () const
 
virtual ~ctkCollapsibleButton ()
 

Protected Slots

virtual void collapse (bool c)
 
virtual void onToggled (bool clicked=false)
 

Protected Member Functions

virtual QSize buttonSizeHint () const
 Compute the size hint of the head button only. The sizehint depends on the text. More...
 
virtual void childEvent (QChildEvent *c)
 
virtual bool hitButton (const QPoint &pos) const
 
virtual void initStyleOption (QStyleOptionButton *option) const
 
virtual void paintEvent (QPaintEvent *)
 

Protected Attributes

QScopedPointer< ctkCollapsibleButtonPrivate > d_ptr
 

Properties

Qt::Alignment buttonTextAlignment
 
bool collapsed
 
int collapsedHeight
 
QFrame::Shadow contentsFrameShadow
 
QFrame::Shape contentsFrameShape
 
int contentsLineWidth
 
int contentsMidLineWidth
 
bool flat
 
Qt::Alignment indicatorAlignment
 

Detailed Description

A collapsible button that shows/hides its children depending on its checked/collapsed property. Warning: <old behavior> As ctkCollapsibleButton forces the Visiblity of its children to true when it get expanded, any child Visibility property is lost. All the widgets will then be visible. To avoid this behavior, use an intermediate widget that contains all the children (they would become grandchildren and their Visibility property will remain relative to their parent, ctkCollapsibleButton's unique child widget.</old behavior> Note: The user QAbstractButton::icon is not visible (it's placeholder is used to display the collapsible state

Definition at line 45 of file ctkCollapsibleButton.h.

Constructor & Destructor Documentation

◆ ctkCollapsibleButton() [1/2]

ctkCollapsibleButton::ctkCollapsibleButton ( QWidget *  parent = 0)

◆ ctkCollapsibleButton() [2/2]

ctkCollapsibleButton::ctkCollapsibleButton ( const QString &  text,
QWidget *  parent = 0 
)

◆ ~ctkCollapsibleButton()

virtual ctkCollapsibleButton::~ctkCollapsibleButton ( )
virtual

Member Function Documentation

◆ buttonSizeHint()

virtual QSize ctkCollapsibleButton::buttonSizeHint ( ) const
protectedvirtual

Compute the size hint of the head button only. The sizehint depends on the text.

◆ buttonTextAlignment()

Qt::Alignment ctkCollapsibleButton::buttonTextAlignment ( ) const

◆ childEvent()

virtual void ctkCollapsibleButton::childEvent ( QChildEvent *  c)
protectedvirtual

◆ collapse

virtual void ctkCollapsibleButton::collapse ( bool  c)
protectedvirtualslot

Perform the collapse.

◆ collapsed()

bool ctkCollapsibleButton::collapsed ( ) const

◆ collapsedHeight()

int ctkCollapsibleButton::collapsedHeight ( ) const

◆ contentsCollapsed

void ctkCollapsibleButton::contentsCollapsed ( bool  )
signal

Signal emitted when the widget is collapsed or expanded. See signal toggled(bool) for the opposite.

◆ contentsFrameShadow()

QFrame::Shadow ctkCollapsibleButton::contentsFrameShadow ( ) const

Set the frame shadow of the contents Hint: Raised is probably the shadow you are looking for

◆ contentsFrameShape()

QFrame::Shape ctkCollapsibleButton::contentsFrameShape ( ) const

Set the frame shape of the contents Hint: StyledPanel is probably the shape you are looking for

◆ contentsLineWidth()

int ctkCollapsibleButton::contentsLineWidth ( ) const

Set the line width of the frame around the contents

◆ contentsMidLineWidth()

int ctkCollapsibleButton::contentsMidLineWidth ( ) const

Set the mid line width of the frame around the contents

◆ event()

virtual bool ctkCollapsibleButton::event ( QEvent *  event)
virtual

Reimplemented to update the size of the button in case of font/style change

◆ eventFilter()

virtual bool ctkCollapsibleButton::eventFilter ( QObject *  child,
QEvent *  e 
)
virtual

Reimplemented for internal reasons Catch when a child widget's visibility is externally changed

◆ hitButton()

virtual bool ctkCollapsibleButton::hitButton ( const QPoint &  pos) const
protectedvirtual

◆ indicatorAlignment()

Qt::Alignment ctkCollapsibleButton::indicatorAlignment ( ) const

◆ initStyleOption()

virtual void ctkCollapsibleButton::initStyleOption ( QStyleOptionButton *  option) const
protectedvirtual

Initialize option with the values from this ctkCollapsibleButton. This method is useful for subclasses when they need a QStyleOptionButton, but don't want to fill in all the information themselves.

◆ isFlat()

bool ctkCollapsibleButton::isFlat ( ) const

Return the flat property value.

See also
flat, setFlat()

◆ minimumSizeHint()

virtual QSize ctkCollapsibleButton::minimumSizeHint ( ) const
virtual

Reimplemented for internal reasons

◆ onToggled

virtual void ctkCollapsibleButton::onToggled ( bool  clicked = false)
protectedvirtualslot

◆ paintEvent()

virtual void ctkCollapsibleButton::paintEvent ( QPaintEvent *  )
protectedvirtual

◆ setButtonTextAlignment()

void ctkCollapsibleButton::setButtonTextAlignment ( Qt::Alignment  textAlignment)

Set the alignment of the text on the button, Qt::AlignLeft|Qt::AlignVCenter by default.

◆ setCollapsed()

void ctkCollapsibleButton::setCollapsed ( bool  )

Property that describes if the widget is collapsed or not. When collapsed, the children are invisible and the widget has a sized defined by CollapsedHeight

◆ setCollapsedHeight()

void ctkCollapsibleButton::setCollapsedHeight ( int  heightInPixels)
Todo:
resize the widget when setting the new height

◆ setContentsFrameShadow()

void ctkCollapsibleButton::setContentsFrameShadow ( QFrame::Shadow  )

◆ setContentsFrameShape()

void ctkCollapsibleButton::setContentsFrameShape ( QFrame::Shape  )

◆ setContentsLineWidth()

void ctkCollapsibleButton::setContentsLineWidth ( int  )

◆ setContentsMidLineWidth()

void ctkCollapsibleButton::setContentsMidLineWidth ( int  )

◆ setFlat()

void ctkCollapsibleButton::setFlat ( bool  flat)

Set the flat property value.

See also
flat, isFlat()

◆ setIndicatorAlignment()

void ctkCollapsibleButton::setIndicatorAlignment ( Qt::Alignment  indicatorAlignment)

Set the alignment of the indicator (arrow) on the button, Qt::AlignLeft|Qt::AlignVCenter by default.

◆ setVisible()

virtual void ctkCollapsibleButton::setVisible ( bool  )
virtual

Reimplemented for internal reasons Don't process Show/Hide events of children when it is ctkCollapsibleButton that generate them.

◆ sizeHint()

virtual QSize ctkCollapsibleButton::sizeHint ( ) const
virtual

Reimplemented for internal reasons

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkCollapsibleButtonPrivate> ctkCollapsibleButton::d_ptr
protected

Definition at line 175 of file ctkCollapsibleButton.h.

Property Documentation

◆ buttonTextAlignment

Qt::Alignment ctkCollapsibleButton::buttonTextAlignment
readwrite

Definition at line 1 of file ctkCollapsibleButton.h.

◆ collapsed

bool ctkCollapsibleButton::collapsed
readwrite

Definition at line 1 of file ctkCollapsibleButton.h.

◆ collapsedHeight

int ctkCollapsibleButton::collapsedHeight
readwrite

This property holds the height in pixels of the contents (excludes the button) when the button is collapsed. 14 pixels by default (same as ctkCollapsibleGroupBox)

Definition at line 1 of file ctkCollapsibleButton.h.

◆ contentsFrameShadow

QFrame::Shadow ctkCollapsibleButton::contentsFrameShadow
readwrite

Definition at line 1 of file ctkCollapsibleButton.h.

◆ contentsFrameShape

QFrame::Shape ctkCollapsibleButton::contentsFrameShape
readwrite

Definition at line 1 of file ctkCollapsibleButton.h.

◆ contentsLineWidth

int ctkCollapsibleButton::contentsLineWidth
readwrite

Definition at line 1 of file ctkCollapsibleButton.h.

◆ contentsMidLineWidth

int ctkCollapsibleButton::contentsMidLineWidth
readwrite

Definition at line 1 of file ctkCollapsibleButton.h.

◆ flat

bool ctkCollapsibleButton::flat
readwrite

This property holds whether the button border is raised. This property's default is false. If this property is set, most styles will not pain the button background unless the button is being pressed.

See also
isFlat(), setFlat(), QPushButton::flat

Definition at line 1 of file ctkCollapsibleButton.h.

◆ indicatorAlignment

Qt::Alignment ctkCollapsibleButton::indicatorAlignment
readwrite

Definition at line 1 of file ctkCollapsibleButton.h.


The documentation for this class was generated from the following file: