Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
style_helpers.h
1#pragma once
2
3#include <QIcon>
4#include <QList>
5#include <QString>
6#include <QTreeWidgetItem>
7#include <QVBoxLayout>
8#include <QWidget>
9#include <oclero/qlementine/utils/BadgeUtils.hpp>
10
11#include "config.h"
12#include "logging.h"
13
18{
19 QObject* widget;
20 QString path;
21 int index;
22 QColor color;
23 QModelIndex mindex;
24};
25
30{
31 QObject* widget;
32 const char* text;
33 int index;
34 bool tooltip = false;
35 QModelIndex mindex;
36};
37
42{
43 QTreeWidgetItem* widget;
44 QString path;
45 QColor color;
46};
47
54void addClass(QWidget* object, const QString& className);
55
63QPointF snapToGrid(const QPointF& point, const int gridSize);
64
71QString ToLabel(const QString& str);
72QString ToLabel(const std::string& str);
73
81QPixmap applyColorToIcon(const QString& path, const QColor& color);
82
90QIcon addIconWithColor(const QString& path, const QColor& color);
91
100QIcon iconFromTheme(const QString& name, bool fallback = false);
101
102QString iconPathFromTheme(const QString& name, bool useLocal = true);
103
110QString timeToQT(std::chrono::system_clock::time_point ts);
111
118QString logLevelToQT(logging::LogLevel logLevel);
119
126oclero::qlementine::StatusBadge logLevelToStatusBadge(logging::LogLevel logLevel);
127
136QString toQT(std::chrono::system_clock::time_point ts, logging::LogLevel level, const std::string& message);
137
145void addDynamicWidget(QVBoxLayout* layout, QWidget* dynamicWidget, QWidget* parent);
146
154void updateProperty(QWidget* widget, const QString& property, bool value);
155
162void applyStyle(QWidget* widget, const QString& style);
163
170void addSectionLabel(QMenu* menu, const QString& text);
171
179QString elideLeft(const QString& text, const QWidget* const component);
180
188QString elideRight(const QString& text, const QWidget* const component);
189
195void clearLayout(QLayout* layout, int start = 0);
196
202void updateIconTheme(QList<WidgetWithIcon>& icons);
203
209void updateTreeIconTheme(QList<TreeWidgetWithIcon>& icons);
210
217QString htmlEscape(const QString& s);
218
225QString createInformationMessage(const NodeConfig& node);
226
232QString createDefaultMessage();
Configuration for a node.
Definition config.h:209
Represents a translatable widget with text and optional tooltip.
Definition style_helpers.h:30
bool tooltip
Index of the widget.
Definition style_helpers.h:34
const char * text
Pointer to the widget.
Definition style_helpers.h:32
int index
Text for the widget.
Definition style_helpers.h:33
QModelIndex mindex
Whether the widget has a tooltip.
Definition style_helpers.h:35
Represents a tree widget with an associated icon and path.
Definition style_helpers.h:42
QColor color
Path to the icon.
Definition style_helpers.h:45
QString path
Pointer to the tree widget.
Definition style_helpers.h:44
Represents a widget with an associated icon and path.
Definition style_helpers.h:18
QColor color
Index of the widget.
Definition style_helpers.h:22
QString path
Pointer to the widget.
Definition style_helpers.h:20
QModelIndex mindex
Color for the icon.
Definition style_helpers.h:23
int index
Path to the icon.
Definition style_helpers.h:21