Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
gl_transition_widget.h
Go to the documentation of this file.
1
#ifndef GL_TRANSITION_WIDGET_H
2
#define GL_TRANSITION_WIDGET_H
3
4
#include <QOpenGLWidget>
5
6
class
QPropertyAnimation;
7
16
class
GLTransitionWidget
final :
public
QOpenGLWidget {
17
Q_OBJECT
19
Q_PROPERTY(
float
offset
READ
GetOffset
WRITE
SetOffset
)
20
21
public
:
27
explicit
GLTransitionWidget
(QWidget *parent =
nullptr
);
28
33
~GLTransitionWidget
()
override
;
34
42
void
SetWidgets
(QWidget *current_widget, QWidget *next_widget);
43
50
void
StartTransition
(
int
duration);
51
56
float
GetOffset
()
const
{
return
offset_
; }
57
64
void
SetOffset
(
float
offset
);
65
66
signals:
70
void
transitionFinished
();
71
72
protected
:
79
void
paintEvent
(QPaintEvent *event)
override
;
80
81
private
:
83
QPixmap
current_pixmap_
;
85
QPixmap
next_pixmap_
;
87
float
offset_
= 0.0f;
89
QPropertyAnimation *
animation_
=
nullptr
;
90
};
91
92
#endif
// GL_TRANSITION_WIDGET_H
GLTransitionWidget::offset_
float offset_
Current progress of the transition animation (0.0 = start, 1.0 = end).
Definition
gl_transition_widget.h:87
GLTransitionWidget::StartTransition
void StartTransition(int duration)
Starts the slide transition animation. Configures and starts the QPropertyAnimation to animate the 'o...
Definition
gl_transition_widget.cpp:36
GLTransitionWidget::SetWidgets
void SetWidgets(QWidget *current_widget, QWidget *next_widget)
Sets the widgets involved in the transition. Captures the current visual state of the provided widget...
Definition
gl_transition_widget.cpp:23
GLTransitionWidget::transitionFinished
void transitionFinished()
Emitted when the transition animation (QPropertyAnimation) finishes.
GLTransitionWidget::SetOffset
void SetOffset(float offset)
Sets the transition offset. This is typically called by the QPropertyAnimation. Updates the internal ...
Definition
gl_transition_widget.cpp:44
GLTransitionWidget::GLTransitionWidget
GLTransitionWidget(QWidget *parent=nullptr)
Constructs a GLTransitionWidget. Initializes the QPropertyAnimation for the offset and sets widget at...
Definition
gl_transition_widget.cpp:8
GLTransitionWidget::GetOffset
float GetOffset() const
Gets the current transition offset.
Definition
gl_transition_widget.h:56
GLTransitionWidget::~GLTransitionWidget
~GLTransitionWidget() override
Destructor. Cleans up the QPropertyAnimation.
Definition
gl_transition_widget.cpp:19
GLTransitionWidget::animation_
QPropertyAnimation * animation_
Animation object controlling the 'offset' property over time.
Definition
gl_transition_widget.h:89
GLTransitionWidget::current_pixmap_
QPixmap current_pixmap_
Pixmap captured from the widget sliding out.
Definition
gl_transition_widget.h:83
GLTransitionWidget::offset
float offset
Property controlling the horizontal offset during the transition (0.0 to 1.0). Animatable.
Definition
gl_transition_widget.h:19
GLTransitionWidget::paintEvent
void paintEvent(QPaintEvent *event) override
Overridden paint event handler. Renders the transition frame. Draws the current_pixmap_ sliding out t...
Definition
gl_transition_widget.cpp:51
GLTransitionWidget::next_pixmap_
QPixmap next_pixmap_
Pixmap captured from the widget sliding in.
Definition
gl_transition_widget.h:85
src
ui
widgets
gl_transition_widget.h
Generated by
1.13.2