QElectroTech  0.8-dev
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
QWidgetAnimation Class Reference

The QWidgetAnimation class This class animate the show and hide function of a QWidget. More...

#include <qwidgetanimation.h>

Inherits QPropertyAnimation.

Collaboration diagram for QWidgetAnimation:
Collaboration graph

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. More...
 
void widgetToSubtract (QVector< QWidget * > widgets)
 QWidgetAnimation::widgetToSubtract Widget to subtract the size when the behavior is availableSpace. More...
 
void show ()
 QWidgetAnimation::show show the widget. More...
 
void hide ()
 QWidgetAnimation::hide Hide the widget. More...
 
void setHidden (bool hidden)
 QWidgetAnimation::setHidden true hide, false show. More...
 
void setLastShowSize (int size)
 QWidgetAnimation::setLastShowSize Force the last show size value to size. More...
 

Private Types

enum  currentState { Showing, Hidding, 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
 

Detailed Description

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 don't change the current and final size of the widget but her maximum size during the animation process, we must to know in advance the final size of the widget. Behavior minimumSizeHint : the final size of the widget will be his minimum size hint. Behavior availableSpace : the final size of widget will be the available size of her parent. Since parent can have other widgets you can add a QVector of widget to subtract of 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 he was showed.

Member Enumeration Documentation

◆ Behavior

Enumerator
minimumSizeHint 
availableSpace 
lastSize 

◆ currentState

Enumerator
Showing 
Hidding 
Finish 

Constructor & Destructor Documentation

◆ QWidgetAnimation()

QWidgetAnimation::QWidgetAnimation ( QWidget *  widget,
Qt::Orientation  orientation,
QWidgetAnimation::Behavior  behavior = QWidgetAnimation::minimumSizeHint,
int  duration = 250 
)

QWidgetAnimation::QWidgetAnimation.

Parameters
widget: widget to animate
orientation: animate widget horizontally or vertically
behavior:
duration: the duration of animation
See also
void QVariantAnimation::setDuration(int msecs)

Member Function Documentation

◆ hide()

void QWidgetAnimation::hide ( )

QWidgetAnimation::hide Hide the widget.

Here is the caller graph for this function:

◆ setHidden()

void QWidgetAnimation::setHidden ( bool  hidden)

QWidgetAnimation::setHidden true hide, false show.

Parameters
hidden
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLastShowSize()

void QWidgetAnimation::setLastShowSize ( int  size)

QWidgetAnimation::setLastShowSize Force the last show size value to size.

Parameters
size

◆ show()

void QWidgetAnimation::show ( )

QWidgetAnimation::show show the widget.

Here is the caller graph for this function:

◆ widgetToSubtract()

void QWidgetAnimation::widgetToSubtract ( QVector< QWidget * >  widgets)

QWidgetAnimation::widgetToSubtract Widget to subtract the size when the behavior is availableSpace.

Parameters
widgets
Here is the caller graph for this function:

Member Data Documentation

◆ m_behavior

QWidgetAnimation::Behavior QWidgetAnimation::m_behavior = Behavior::minimumSizeHint
private

◆ m_last_rect

QRect QWidgetAnimation::m_last_rect
private

◆ m_maximum

QSize QWidgetAnimation::m_maximum
private

◆ m_orientation

Qt::Orientation QWidgetAnimation::m_orientation = Qt::Horizontal
private

◆ m_state

QWidgetAnimation::currentState QWidgetAnimation::m_state = QWidgetAnimation::Finish
private

◆ m_widget

QWidget* QWidgetAnimation::m_widget
private

◆ m_widget_to_substract

QVector<QWidget *> QWidgetAnimation::m_widget_to_substract
private

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