QElectroTech  0.8-dev
qwidgetanimation.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef QWIDGETANIMATION_H
19 #define QWIDGETANIMATION_H
20 
21 #include <QPropertyAnimation>
22 #include <QSize>
23 #include <QRect>
24 
45 class QWidgetAnimation : public QPropertyAnimation
46 {
47  Q_OBJECT
48 
49  public:
50  enum Behavior {
54  };
55 
57  QWidget *widget,
58  Qt::Orientation orientation,
61  int duration = 250);
62  void widgetToSubtract (QVector<QWidget *> widgets);
63 
64  void show();
65  void hide();
66  void setHidden(bool hidden);
67  void setLastShowSize(int size);
68 
69  private:
70  enum currentState {
73  Finish
74  };
75 
76  Qt::Orientation m_orientation = Qt::Horizontal;
77  QVector <QWidget *> m_widget_to_substract;
78  QWidget *m_widget;
79  QSize m_maximum;
80  QRect m_last_rect;
81  QWidgetAnimation::Behavior m_behavior = Behavior::minimumSizeHint;
83 };
84 
85 #endif // QWIDGETANIMATION_H
QWidgetAnimation::Behavior
Behavior
Definition: qwidgetanimation.h:50
QWidgetAnimation::m_behavior
QWidgetAnimation::Behavior m_behavior
Definition: qwidgetanimation.h:81
QWidgetAnimation::lastSize
@ lastSize
Definition: qwidgetanimation.h:53
QWidgetAnimation::setHidden
void setHidden(bool hidden)
QWidgetAnimation::setHidden true hide, false show.
Definition: qwidgetanimation.cpp:160
qwidgetanimation.h
QWidgetAnimation::availableSpace
@ availableSpace
Definition: qwidgetanimation.h:52
QWidgetAnimation::QWidgetAnimation
QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, QWidgetAnimation::Behavior behavior=QWidgetAnimation::minimumSizeHint, int duration=250)
QWidgetAnimation::QWidgetAnimation.
Definition: qwidgetanimation.cpp:29
QWidgetAnimation::m_state
QWidgetAnimation::currentState m_state
Definition: qwidgetanimation.h:82
QWidgetAnimation::m_widget_to_substract
QVector< QWidget * > m_widget_to_substract
Definition: qwidgetanimation.h:77
QWidgetAnimation::hide
void hide()
QWidgetAnimation::hide Hide the widget.
Definition: qwidgetanimation.cpp:136
QWidgetAnimation::show
void show()
QWidgetAnimation::show show the widget.
Definition: qwidgetanimation.cpp:78
QWidgetAnimation::m_maximum
QSize m_maximum
Definition: qwidgetanimation.h:79
QWidgetAnimation
The QWidgetAnimation class This class animate the show and hide function of a QWidget.
Definition: qwidgetanimation.h:46
QWidgetAnimation::setLastShowSize
void setLastShowSize(int size)
QWidgetAnimation::setLastShowSize Force the last show size value to size.
Definition: qwidgetanimation.cpp:173
QWidgetAnimation::Showing
@ Showing
Definition: qwidgetanimation.h:71
QWidgetAnimation::minimumSizeHint
@ minimumSizeHint
Definition: qwidgetanimation.h:51
QWidgetAnimation::currentState
currentState
Definition: qwidgetanimation.h:70
QET::Vertical
@ Vertical
Vertical segment.
Definition: qet.h:90
QET::Horizontal
@ Horizontal
Horizontal segment.
Definition: qet.h:89
QWidgetAnimation::Finish
@ Finish
Definition: qwidgetanimation.h:73
QWidgetAnimation::m_widget
QWidget * m_widget
Definition: qwidgetanimation.h:78
QWidgetAnimation::widgetToSubtract
void widgetToSubtract(QVector< QWidget * > widgets)
QWidgetAnimation::widgetToSubtract Widget to subtract the size when the behavior is availableSpace.
Definition: qwidgetanimation.cpp:68
QWidgetAnimation::Hidding
@ Hidding
Definition: qwidgetanimation.h:72
QWidgetAnimation::m_orientation
Qt::Orientation m_orientation
Definition: qwidgetanimation.h:76
QWidgetAnimation::m_last_rect
QRect m_last_rect
Definition: qwidgetanimation.h:80