Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
tab_button.h
Go to the documentation of this file.
1
#ifndef TAB_BUTTON_H
2
#define TAB_BUTTON_H
3
4
#include <QPushButton>
5
15
class
TabButton
final :
public
QPushButton {
16
Q_OBJECT
22
Q_PROPERTY(
double
underlineOffset
READ
UnderlineOffset
WRITE
SetUnderlineOffset
)
23
24
public
:
32
explicit
TabButton
(
const
QString &text, QWidget *parent =
nullptr
);
33
38
double
UnderlineOffset
()
const
{
return
underline_offset_
; }
39
45
void
SetUnderlineOffset
(
double
offset);
46
54
void
SetActive
(
bool
active);
55
56
protected
:
61
void
enterEvent
(QEvent *event)
override
;
62
67
void
leaveEvent
(QEvent *event)
override
;
68
76
void
paintEvent
(QPaintEvent *event)
override
;
77
78
private
:
80
double
underline_offset_
;
82
bool
is_active_
;
83
};
84
85
86
#endif
//TAB_BUTTON_H
TabButton::leaveEvent
void leaveEvent(QEvent *event) override
Overridden leave event handler. Starts the animation to hide the underline if the button is inactive.
Definition
tab_button.cpp:55
TabButton::TabButton
TabButton(const QString &text, QWidget *parent=nullptr)
Constructs a TabButton. Initializes the button as flat, checkable, sets the cursor,...
Definition
tab_button.cpp:7
TabButton::underlineOffset
double underlineOffset
Property controlling the animation state of the underline effect on hover (0.0 to 5....
Definition
tab_button.h:22
TabButton::underline_offset_
double underline_offset_
Current animation offset for the underline effect (0.0 to 5.0).
Definition
tab_button.h:80
TabButton::SetActive
void SetActive(bool active)
Sets the active state of the tab button. An active button displays a full, static underline....
Definition
tab_button.cpp:38
TabButton::is_active_
bool is_active_
Flag indicating if the tab button is currently considered active (displays full underline).
Definition
tab_button.h:82
TabButton::paintEvent
void paintEvent(QPaintEvent *event) override
Overridden paint event handler. Draws the custom underline effect. Calls the base class paintEvent fi...
Definition
tab_button.cpp:67
TabButton::UnderlineOffset
double UnderlineOffset() const
Gets the current value of the underline animation offset.
Definition
tab_button.h:38
TabButton::enterEvent
void enterEvent(QEvent *event) override
Overridden enter event handler. Starts the animation to show the underline if the button is inactive.
Definition
tab_button.cpp:43
TabButton::SetUnderlineOffset
void SetUnderlineOffset(double offset)
Sets the value of the underline animation offset. Triggers a repaint of the button....
Definition
tab_button.cpp:33
src
ui
buttons
tab_button.h
Generated by
1.13.2