CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Slots | Public Member Functions | Protected Slots | Protected Member Functions | Properties | List of all members
ctkPopupWidget Class Reference

#include <Libs/Widgets/ctkPopupWidget.h>

Inheritance diagram for ctkPopupWidget:
Inheritance graph
Collaboration diagram for ctkPopupWidget:
Collaboration graph

Public Types

typedef ctkBasePopupWidget Superclass
- Public Types inherited from ctkBasePopupWidget
enum  AnimationEffect { WindowOpacityFadeEffect = 0, ScrollEffect, FadeEffect }
typedef QFrame Superclass
enum  VerticalDirection { TopToBottom = 1, BottomToTop = 2 }

Public Slots

void pinPopup (bool pin)
- Public Slots inherited from ctkBasePopupWidget
virtual void showPopup ()
void showPopup (bool show)

Public Member Functions

bool autoHide () const
bool autoShow () const
 ctkPopupWidget (QWidget *parent=0)
int hideDelay () const
virtual void hidePopup ()
 Reimplemented for internal reasons. More...
bool isActive () const
void setActive (bool)
void setAutoHide (bool autoHide)
void setAutoShow (bool)
void setHideDelay (int delay)
void setShowDelay (int delay)
int showDelay () const
virtual ~ctkPopupWidget ()
- Public Member Functions inherited from ctkBasePopupWidget
Qt::Alignment alignment () const
AnimationEffect animationEffect () const
QWidget * baseWidget () const
 ctkBasePopupWidget (QWidget *parent=0)
QEasingCurve::Type easingCurve () const
double effectAlpha () const
int effectDuration () const
QRect effectGeometry () const
virtual bool event (QEvent *event)
Qt::LayoutDirection horizontalDirection () const
Qt::Orientations orientation () const
virtual void paintEvent (QPaintEvent *)
void setAlignment (Qt::Alignment alignment)
void setAnimationEffect (AnimationEffect effect)
void setEasingCurve (QEasingCurve::Type easingCurve)
void setEffectDuration (int duration)
void setHorizontalDirection (Qt::LayoutDirection direction)
void setOrientation (Qt::Orientations orientation)
void setVerticalDirection (VerticalDirection direction)
VerticalDirection verticalDirection () const
virtual ~ctkBasePopupWidget ()

Protected Slots

virtual void onEffectFinished ()
void updatePopup ()
- Protected Slots inherited from ctkBasePopupWidget
void onBaseWidgetDestroyed ()
virtual void onEffectFinished ()
void setEffectAlpha (double alpha)
void setEffectGeometry (QRect geometry)

Protected Member Functions

virtual void enterEvent (QEvent *event)
virtual bool eventFilter (QObject *obj, QEvent *event)
virtual void leaveEvent (QEvent *event)
virtual void setBaseWidget (QWidget *baseWidget)
- Protected Member Functions inherited from ctkBasePopupWidget
 ctkBasePopupWidget (ctkBasePopupWidgetPrivate *pimpl, QWidget *parent=0)


bool active
bool autoHide
bool autoShow
int hideDelay
int showDelay
- Properties inherited from ctkBasePopupWidget
Qt::Alignment alignment
AnimationEffect animationEffect
QEasingCurve::Type easingCurve
double effectAlpha
int effectDuration
QRect effectGeometry
Qt::LayoutDirection horizontalDirection
Qt::Orientations orientation
ctkBasePopupWidget::VerticalDirection verticalDirection

Additional Inherited Members

- Signals inherited from ctkBasePopupWidget
void popupOpened (bool open)
- Protected Attributes inherited from ctkBasePopupWidget
< ctkBasePopupWidgetPrivate > 

Detailed Description

ctkPopupWidget is a specialization of ctkBasePopupWidget that handles the opening and closing of the popup. Below is an example of a popup slider that opens and closes next to a button

ctkPopupWidget* popup = new ctkPopupWidget(pushButton);
popup->setAlignment(Qt::AlignRight | Qt::AlignTop | Qt::AlignBottom);
QHBoxLayout* popupLayout = new QHBoxLayout(popup);
QSlider* popupSlider = new QSlider(popup);
See also

Definition at line 43 of file ctkPopupWidget.h.

Member Typedef Documentation

Definition at line 78 of file ctkPopupWidget.h.

Constructor & Destructor Documentation

ctkPopupWidget::ctkPopupWidget ( QWidget *  parent = 0)

By default, the parent is the baseWidget.

See also
virtual ctkPopupWidget::~ctkPopupWidget ( )

Member Function Documentation

bool ctkPopupWidget::autoHide ( ) const
bool ctkPopupWidget::autoShow ( ) const
virtual void ctkPopupWidget::enterEvent ( QEvent *  event)
virtual bool ctkPopupWidget::eventFilter ( QObject *  obj,
QEvent *  event 
int ctkPopupWidget::hideDelay ( ) const
virtual void ctkPopupWidget::hidePopup ( )

Reimplemented for internal reasons.

Reimplemented from ctkBasePopupWidget.

bool ctkPopupWidget::isActive ( ) const
virtual void ctkPopupWidget::leaveEvent ( QEvent *  event)
virtual void ctkPopupWidget::onEffectFinished ( )
void ctkPopupWidget::pinPopup ( bool  pin)

Convenient function that calls setAutoHide(!pin) and opens the popup if pin is true regardless of the value of AutoShow. It is typically connected with a checkable button to anchor the popup.

void ctkPopupWidget::setActive ( bool  )
void ctkPopupWidget::setAutoHide ( bool  autoHide)

Don't automatically close the popup when leaving the widget. Calling setAutoHide automatically updates the state close the popup if the mouse is not over the popup nor the base widget.

void ctkPopupWidget::setAutoShow ( bool  )

Calling setAutoShow automatically updates opens the popup if the cursor is above the popup or the base widget.

virtual void ctkPopupWidget::setBaseWidget ( QWidget *  baseWidget)

Widget the popup is attached to. It opens right under baseWidget and if the ctkPopupWidget sizepolicy contains the growFlag/shrinkFlag, it tries to resize itself to fit the same width of baseWidget.

Reimplemented from ctkBasePopupWidget.

void ctkPopupWidget::setHideDelay ( int  delay)
void ctkPopupWidget::setShowDelay ( int  delay)
int ctkPopupWidget::showDelay ( ) const
void ctkPopupWidget::updatePopup ( )

Property Documentation

bool ctkPopupWidget::active

Control whether the popup listens to the application and baseWidget events and decides if it needs to be permanently or temporarily hidden. You might want to setActive(false) when embedding the popup into a static layout intead of having it top-level (no parent). Consider also removing its windowFlags (Qt::ToolTip | Qt::FramelessWindowHint) and removing the baseWidget. True by default

See also
isActive(), setActive()

Definition at line 55 of file ctkPopupWidget.h.

bool ctkPopupWidget::autoHide

Control wether the popup automatically closes when the mouse leaves the widget. True by default.

See also
autoHide(), setAutoHide()

Definition at line 70 of file ctkPopupWidget.h.

bool ctkPopupWidget::autoShow

Control wether the popup automatically opens when the mouse enter the widget. True by default

See also
autoShow(), setAutoShow()

Definition at line 60 of file ctkPopupWidget.h.

int ctkPopupWidget::hideDelay

Time in ms to wait before closing the popup if autoHide is set. 200ms by default

See also
hideDelay(), setHideDelay()

Definition at line 75 of file ctkPopupWidget.h.

int ctkPopupWidget::showDelay

Time in ms to wait before opening the popup if autoShow is set. 20ms by default

See also
showDelay(), setShowDelay()

Definition at line 65 of file ctkPopupWidget.h.

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