QElectroTech 0.100.0-dev
|
The QWidgetAnimation class This class animate the show and hide function of a QWidget. More...
#include <qwidgetanimation.h>
Inherits QPropertyAnimation.
Public Types | |
enum | Behavior { minimumSizeHint , availableSpace , lastSize } |
Public Member Functions | |
QWidgetAnimation (QWidget *widget, Qt::Orientation orientation, QWidgetAnimation::Behavior behavior=QWidgetAnimation::minimumSizeHint, int duration=250) | |
QWidgetAnimation::QWidgetAnimation. | |
void | widgetToSubtract (QVector< QWidget * > widgets) |
QWidgetAnimation::widgetToSubtract Widget to subtract the size when the behavior is availableSpace. | |
void | show () |
QWidgetAnimation::show show the widget. | |
void | hide () |
QWidgetAnimation::hide Hide the widget. | |
void | setHidden (bool hidden) |
QWidgetAnimation::setHidden true hide, false show. | |
void | setLastShowSize (int size) |
QWidgetAnimation::setLastShowSize Force the last show size value to size. | |
Private Types | |
enum | currentState { Showing , Hiding , Finish } |
Private Attributes | |
Qt::Orientation | m_orientation = Qt::Horizontal |
QVector< QWidget * > | m_widget_to_substract |
QWidget * | m_widget |
QSize | m_maximum |
QRect | m_last_rect |
QWidgetAnimation::Behavior | m_behavior = Behavior::minimumSizeHint |
QWidgetAnimation::currentState | m_state = QWidgetAnimation::Finish |
The QWidgetAnimation class This class animate the show and hide function of a QWidget.
The role of behavior is to calcul as best the animation process when widget is show. Because this class doesn't change the current and final size of the widget but its maximum size during the animation process, we need to know in advance the final size of the widget. Behavior minimumSizeHint : the final size of the widget will be its minimum size hint. Behavior availableSpace : the final size of widget will be the available size of its parent. Since parent can have other widgets you can add a QVector of widget to subtract from the final size. Because we suppose the animated widget will take the maximum available space, we subtract the minimum size hint of widgets in QVector. Behavior lastSize : The widget will have the same size as the last time it was displayed.
|
private |
QWidgetAnimation::QWidgetAnimation | ( | QWidget * | widget, |
Qt::Orientation | orientation, | ||
QWidgetAnimation::Behavior | behavior = QWidgetAnimation::minimumSizeHint , |
||
int | duration = 250 |
||
) |
QWidgetAnimation::QWidgetAnimation.
widget | : widget to animate |
orientation | : animate widget horizontally or vertically |
behavior | : |
duration | : the duration of animation |
void QWidgetAnimation::hide | ( | ) |
void QWidgetAnimation::setHidden | ( | bool | hidden | ) |
QWidgetAnimation::setHidden true hide, false show.
hidden |
void QWidgetAnimation::setLastShowSize | ( | int | size | ) |
QWidgetAnimation::setLastShowSize Force the last show size value to size.
size |
void QWidgetAnimation::show | ( | ) |
void QWidgetAnimation::widgetToSubtract | ( | QVector< QWidget * > | widgets | ) |
QWidgetAnimation::widgetToSubtract Widget to subtract the size when the behavior is availableSpace.
widgets |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |