Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
cyber_line_edit.h
Go to the documentation of this file.
1#ifndef CYBER_INPUT_H
2#define CYBER_INPUT_H
3
4#include <QLineEdit>
5
13class CyberLineEdit final : public QLineEdit {
14 Q_OBJECT
16 Q_PROPERTY(double glowIntensity READ GetGlowIntensity WRITE SetGlowIntensity)
17
18public:
26 explicit CyberLineEdit(QWidget *parent = nullptr);
27
31 ~CyberLineEdit() override;
32
38 QSize sizeHint() const override;
39
44 double GetGlowIntensity() const { return glow_intensity_; }
45
51 void SetGlowIntensity(double intensity);
52
59 QRect CyberCursorRect() const;
60
61protected:
68 void paintEvent(QPaintEvent *event) override;
69
74 void focusInEvent(QFocusEvent *event) override;
75
80 void focusOutEvent(QFocusEvent *event) override;
81
86 void enterEvent(QEvent *event) override;
87
92 void leaveEvent(QEvent *event) override;
93
98 void keyPressEvent(QKeyEvent *event) override;
99
100private:
107};
108
109
110#endif //CYBER_INPUT_H
QTimer * cursor_blink_timer_
Timer controlling the blinking animation of the custom cursor.
Definition cyber_line_edit.h:104
QSize sizeHint() const override
Returns the recommended size for the line edit. Enforces a minimum height of 30 pixels.
Definition cyber_line_edit.cpp:36
double glow_intensity_
Current intensity of the glow effect. Modified by animations on focus/hover.
Definition cyber_line_edit.h:102
void focusOutEvent(QFocusEvent *event) override
Overridden focus out event handler. Stops the cursor blink timer and animates the glow effect out.
Definition cyber_line_edit.cpp:165
CyberLineEdit(QWidget *parent=nullptr)
Constructs a CyberLineEdit. Initializes the widget with cyberpunk styling (border,...
Definition cyber_line_edit.cpp:8
QRect CyberCursorRect() const
Calculates the rectangle occupied by the custom cursor. Determines the cursor's position based on the...
Definition cyber_line_edit.cpp:47
bool cursor_visible_
Flag indicating whether the custom cursor is currently visible (part of the blink cycle).
Definition cyber_line_edit.h:106
void SetGlowIntensity(double intensity)
Sets the intensity of the glow effect. Triggers a repaint of the line edit.
Definition cyber_line_edit.cpp:42
void leaveEvent(QEvent *event) override
Overridden leave event handler. Animates the glow effect out if the widget doesn't have focus.
Definition cyber_line_edit.cpp:190
~CyberLineEdit() override
Destructor. Stops the cursor blink timer.
Definition cyber_line_edit.cpp:30
void keyPressEvent(QKeyEvent *event) override
Overridden key press event handler. Resets the cursor blink state and timer on key press.
Definition cyber_line_edit.cpp:201
double GetGlowIntensity() const
Gets the current intensity of the glow effect.
Definition cyber_line_edit.h:44
void paintEvent(QPaintEvent *event) override
Overridden paint event handler. Draws the custom line edit appearance. Renders the clipped background...
Definition cyber_line_edit.cpp:66
void enterEvent(QEvent *event) override
Overridden enter event handler. Animates the glow effect partially in if the widget doesn't have focu...
Definition cyber_line_edit.cpp:179
void focusInEvent(QFocusEvent *event) override
Overridden focus in event handler. Starts the cursor blink timer and animates the glow effect in.
Definition cyber_line_edit.cpp:149
double glowIntensity
Property controlling the intensity of the border glow effect (0.0 to 1.0). Animatable.
Definition cyber_line_edit.h:16