Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
frame.h
1#pragma once
2
3#include <QColor>
4#include <QFrame>
5#include <QPainter>
6#include <QPainterPath>
7#include <oclero/qlementine.hpp>
8
9class StyledFrame : public QFrame
10{
11 Q_OBJECT
12
13public:
14 enum class BackgroundRole
15 {
16 Window,
17 Base,
18 Button,
19 Midlight,
20 Custom
21 };
22
23 enum class BorderRole
24 {
25 None,
26 Mid,
27 Highlight,
28 Custom
29 };
30
36 StyledFrame(QWidget* parent = nullptr);
37
43 void setBackgroundRole(BackgroundRole role);
44
50 void setBorderRole(BorderRole role);
51
57 void setCustomBackgroundColor(const QColor& color);
58
64 void setCustomBorderColor(const QColor& color);
65
71 void setBorderWidth(int width);
72
78 void setRadius(qreal radius);
79
80protected:
86 void paintEvent(QPaintEvent* event) override;
87
88private:
89 BackgroundRole mBackgroundRole = BackgroundRole::Base;
90 BorderRole mBorderRole = BorderRole::Mid;
91
94
95 int mBorderWidth = 1;
96 qreal mRadius = 0.0;
97
103 QColor backgroundColor() const;
104
110 QColor borderColor() const;
111};
void paintEvent(QPaintEvent *event) override
Handles the paint event to draw the styled frame.
Definition frame.cpp:49
BorderRole mBorderRole
Current background role.
Definition frame.h:90
qreal mRadius
Width of the border.
Definition frame.h:96
void setBackgroundRole(BackgroundRole role)
Sets the background role of the frame.
Definition frame.cpp:11
void setCustomBackgroundColor(const QColor &color)
Sets a custom background color for the frame.
Definition frame.cpp:23
QColor mCustomBorderColor
Custom background color.
Definition frame.h:93
void setRadius(qreal radius)
Sets the radius for rounded corners.
Definition frame.cpp:43
void setBorderWidth(int width)
Sets the width of the border.
Definition frame.cpp:37
int mBorderWidth
Custom border color.
Definition frame.h:95
QColor backgroundColor() const
Radius for rounded corners.
Definition frame.cpp:75
void setCustomBorderColor(const QColor &color)
Sets a custom border color for the frame.
Definition frame.cpp:30
void setBorderRole(BorderRole role)
Sets the border role of the frame.
Definition frame.cpp:17
QColor mCustomBackgroundColor
Current border role.
Definition frame.h:92
QColor borderColor() const
Returns the current border color based on the role.
Definition frame.cpp:96
StyledFrame(QWidget *parent=nullptr)
Constructs a StyledFrame with the given parent.
Definition frame.cpp:3