31 #ifndef BASEPOPUPWIDGET_H 32 #define BASEPOPUPWIDGET_H 35 #include <QEasingCurve> 39 #include "commonWidgets.h" 49 #if QT_VERSION < 0x050500 51 Q_ENUMS(AnimationEffect)
52 Q_ENUMS(VerticalDirection)
56 Q_PROPERTY( AnimationEffect animationEffect READ animationEffect WRITE setAnimationEffect)
59 Q_PROPERTY(
int effectDuration READ effectDuration WRITE setEffectDuration);
64 Q_PROPERTY( QEasingCurve::Type easingCurve READ easingCurve WRITE setEasingCurve);
69 Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment);
74 Q_PROPERTY( Qt::Orientations orientation READ orientation WRITE setOrientation);
78 Q_PROPERTY( BasePopupWidget::VerticalDirection verticalDirection READ verticalDirection WRITE setVerticalDirection);
82 Q_PROPERTY( Qt::LayoutDirection horizontalDirection READ horizontalDirection WRITE setHorizontalDirection);
85 typedef QFrame Superclass;
100 QWidget* baseWidget()
const;
104 WindowOpacityFadeEffect = 0,
109 AnimationEffect animationEffect()
const;
110 void setAnimationEffect(AnimationEffect effect);
112 int effectDuration()
const;
113 void setEffectDuration(
int duration);
115 QEasingCurve::Type easingCurve()
const;
116 void setEasingCurve(QEasingCurve::Type easingCurve);
118 Qt::Alignment alignment()
const;
119 void setAlignment(Qt::Alignment alignment);
121 Qt::Orientations orientation()
const;
122 void setOrientation(Qt::Orientations orientation);
124 enum VerticalDirection{
129 #if QT_VERSION >= 0x050500 132 Q_ENUM(AnimationEffect);
133 Q_ENUM(VerticalDirection);
136 VerticalDirection verticalDirection()
const;
137 void setVerticalDirection(VerticalDirection direction);
139 Qt::LayoutDirection horizontalDirection()
const;
140 void setHorizontalDirection(Qt::LayoutDirection direction);
145 virtual void hidePopup();
148 virtual void showPopup();
151 inline void showPopup(
bool show);
154 void popupOpened(
bool open);
158 QScopedPointer<BasePopupWidgetPrivate> d_ptr;
159 Q_PROPERTY(
double effectAlpha READ effectAlpha WRITE setEffectAlpha DESIGNABLE
false)
160 Q_PROPERTY(QRect effectGeometry READ effectGeometry WRITE setEffectGeometry DESIGNABLE
false)
162 double effectAlpha()
const;
163 QRect effectGeometry()
const;
165 virtual void setBaseWidget(QWidget* baseWidget);
167 virtual bool event(QEvent* event);
168 virtual void paintEvent(QPaintEvent*);
171 virtual void onEffectFinished();
172 void setEffectAlpha(
double alpha);
173 void setEffectGeometry(QRect geometry);
174 void onBaseWidgetDestroyed();
181 Q_DECLARE_METATYPE(BasePopupWidget::AnimationEffect)