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
[legend]
Collaboration diagram for ctkPopupWidget:
Collaboration graph
[legend]

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)
 

Properties

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
QScopedPointer
< ctkBasePopupWidgetPrivate > 
d_ptr
 

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);
popup->setOrientation(Qt::Horizontal);
QHBoxLayout* popupLayout = new QHBoxLayout(popup);
QSlider* popupSlider = new QSlider(popup);
popupLayout->addWidget(popupSlider);
See also
ctkBasePopupWidget

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)
explicit

By default, the parent is the baseWidget.

See also
baseWidget()
virtual ctkPopupWidget::~ctkPopupWidget ( )
virtual

Member Function Documentation

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

Reimplemented for internal reasons.

Reimplemented from ctkBasePopupWidget.

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

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)
protectedvirtual

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 ( )
protectedslot

Property Documentation

bool ctkPopupWidget::active
readwrite

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
readwrite

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
readwrite

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
readwrite

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
readwrite

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: