itom
Loading...
Searching...
No Matches
BasePopupWidget Class Reference

#include <basePopupWidget.h>

Inheritance diagram for BasePopupWidget:
PopupWidget

Public Types

enum  AnimationEffect { WindowOpacityFadeEffect = 0 , ScrollEffect , FadeEffect }
 
enum  VerticalDirection { TopToBottom = 1 , BottomToTop = 2 }
 
typedef QFrame Superclass
 

Public Slots

virtual void hidePopup ()
 
virtual void showPopup ()
 
void showPopup (bool show)
 

Signals

void popupOpened (bool open)
 

Public Member Functions

 BasePopupWidget (QWidget *parent=0)
 
QWidget * baseWidget () const
 
AnimationEffect animationEffect () const
 
void setAnimationEffect (AnimationEffect effect)
 
int effectDuration () const
 
void setEffectDuration (int duration)
 
QEasingCurve::Type easingCurve () const
 
void setEasingCurve (QEasingCurve::Type easingCurve)
 
Qt::Alignment alignment () const
 
void setAlignment (Qt::Alignment alignment)
 
Qt::Orientations orientation () const
 
void setOrientation (Qt::Orientations orientation)
 
 Q_ENUM (AnimationEffect)
 
 Q_ENUM (VerticalDirection)
 
VerticalDirection verticalDirection () const
 
void setVerticalDirection (VerticalDirection direction)
 
Qt::LayoutDirection horizontalDirection () const
 
void setHorizontalDirection (Qt::LayoutDirection direction)
 

Protected Slots

virtual void onEffectFinished ()
 
void setEffectAlpha (double alpha)
 
void setEffectGeometry (QRect geometry)
 
void onBaseWidgetDestroyed ()
 

Protected Member Functions

 BasePopupWidget (BasePopupWidgetPrivate *pimpl, QWidget *parent=0)
 
double effectAlpha () const
 
QRect effectGeometry () const
 
virtual void setBaseWidget (QWidget *baseWidget)
 
virtual bool event (QEvent *event)
 
virtual void paintEvent (QPaintEvent *)
 

Protected Attributes

QScopedPointer< BasePopupWidgetPrivated_ptr
 

Properties

AnimationEffect animationEffect
 ScrollEffect by default.
 
int effectDuration
 
QEasingCurve::Type easingCurve
 
Qt::Alignment alignment
 
Qt::Orientations orientation
 
BasePopupWidget::VerticalDirection verticalDirection
 
Qt::LayoutDirection horizontalDirection
 
double effectAlpha
 
QRect effectGeometry
 

Private Member Functions

 Q_DECLARE_PRIVATE (BasePopupWidget)
 
 Q_DISABLE_COPY (BasePopupWidget)
 

Detailed Description

Description:

Constructor & Destructor Documentation

◆ BasePopupWidget()

BasePopupWidget::BasePopupWidget ( QWidget * parent = 0)
explicit

Although a popup widget is a top-level widget, if a parent is passed the popup widget will be deleted when that parent is destroyed (as with any other QObject). BasePopupWidget is a top-level widget (Qt::ToolTip), so even if a parent is passed, the popup will display outside the possible parent layout.

See also
baseWidget().

Member Function Documentation

◆ baseWidget()

QWidget * BasePopupWidget::baseWidget ( ) const

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

◆ hidePopup

void BasePopupWidget::hidePopup ( )
virtualslot

Hide the popup if open or opening. It takes around 300ms for the fading effect to hide the popup.

Reimplemented in PopupWidget.

◆ setAnimationEffect()

void BasePopupWidget::setAnimationEffect ( BasePopupWidget::AnimationEffect effect)

TODO: handle the case where there is an animation running

◆ setBaseWidget()

void BasePopupWidget::setBaseWidget ( QWidget * baseWidget)
protectedvirtual

Reimplemented in PopupWidget.

◆ showPopup [1/2]

void BasePopupWidget::showPopup ( )
virtualslot

Open the popup if closed or closing. It takes around 300ms for the fading effect to open the popup.

Maybe the popup doesn't allow the desiredOpenGeometry if the widget minimum size is larger than the desired size.

◆ showPopup [2/2]

void BasePopupWidget::showPopup ( bool show)
inlineslot

Show/hide the popup. It can be conveniently linked to a QPushButton signal.

Property Documentation

◆ alignment

Qt::Alignment BasePopupWidget::alignment
readwrite

Where is the popup in relation to the BaseWidget To vertically justify, use Qt::AlignTop | Qt::AlignBottom Qt::AlignJustify | Qt::AlignBottom by default

◆ easingCurve

QEasingCurve::Type BasePopupWidget::easingCurve
readwrite

Opening/Closing curve QEasingCurve::InOutQuad by default

◆ effectDuration

int BasePopupWidget::effectDuration
readwrite

Effect duration in ms Default to 333ms

◆ horizontalDirection

Qt::LayoutDirection BasePopupWidget::horizontalDirection
readwrite

Control where the popup opens horizontally. LeftToRight by default

◆ orientation

Qt::Orientations BasePopupWidget::orientation
readwrite

Direction of the scrolling effect, can be Qt::Vertical, Qt::Horizontal or both Qt::Vertical|Qt::Horizontal. Vertical by default

◆ verticalDirection

BasePopupWidget::VerticalDirection BasePopupWidget::verticalDirection
readwrite

Control where the popup opens vertically. TopToBottom by default


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