Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
color_utils.h
Go to the documentation of this file.
1
9
10#ifndef COLOR_UTILS_H
11#define COLOR_UTILS_H
12
13#include <config.h>
14
15#include <epan/color_filters.h>
16
17#include <QBrush>
18#include <QColor>
19#include <QObject>
20#include <QRect>
21#include <QStyleOptionViewItem>
22
23class QPainter;
24class QPalette;
25class QAbstractItemView;
26
30class ColorUtils : public QObject
31{
32public:
37 explicit ColorUtils(QObject *parent = 0);
38
44 static QColor fromColorT(const color_t *color);
45
51 static QColor fromColorT(color_t color);
52
58 static const color_t toColorT(const QColor color);
59
67 static QRgb alphaBlend(const QColor &color1, const QColor &color2, qreal alpha);
68
76 static QRgb alphaBlend(const QBrush &brush1, const QBrush &brush2, qreal alpha);
77
78
83 static QBrush themeLinkBrush();
84
89 static QString themeLinkStyle();
90
101 static QString itemHoverStyleSheet(const QString &selector);
102
124 static void paintFlatCell(QPainter *painter, const QAbstractItemView *view,
125 const QStyleOptionViewItem &option, const QModelIndex &index,
126 const QColor &bg, const QColor &fg);
127
134 static const QColor warningBackground();
135
143 static QColor rowSeparatorColor(const QPalette &palette);
144
149 static const QColor disabledForeground();
150
151private:
153 static QList<QRgb> graph_colors_;
154
156 static QList<QRgb> sequence_colors_;
157};
158
165void color_filter_qt_add_cb(color_filter_t *colorf, void *user_data);
166
167#endif // COLOR_UTILS_H
static const color_t toColorT(const QColor color)
Converts a QColor to a core color_t.
Definition color_utils.cpp:48
static const QColor warningBackground()
Returns the warning background color for the current theme. Taken from the FilterDeprecated theme tok...
Definition color_utils.cpp:136
static const QColor disabledForeground()
Returns an appropriate foreground color for disabled text.
Definition color_utils.cpp:150
static QString itemHoverStyleSheet(const QString &selector)
Stylesheet rule for the hover state of an item view's items.
Definition color_utils.cpp:96
ColorUtils(QObject *parent=0)
Constructs a new ColorUtils object.
Definition color_utils.cpp:20
static QRgb alphaBlend(const QColor &color1, const QColor &color2, qreal alpha)
Blends two colors together using the specified alpha factor.
Definition color_utils.cpp:60
static QColor rowSeparatorColor(const QPalette &palette)
Color of the 1px separator line between packet list rows. Equal to Base when Base is light; on a dark...
Definition color_utils.cpp:141
static void paintFlatCell(QPainter *painter, const QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index, const QColor &bg, const QColor &fg)
Paints a single cell with a flat background/text color, ignoring any Qt::BackgroundRole/QtForegroundR...
Definition color_utils.cpp:109
static QBrush themeLinkBrush()
Returns an appropriate link color for the current mode.
Definition color_utils.cpp:80
static QColor fromColorT(const color_t *color)
Converts a core color_t pointer to a QColor.
Definition color_utils.cpp:37
static QString themeLinkStyle()
Returns an appropriate HTML+CSS link style for the current mode.
Definition color_utils.cpp:85
struct _color_filter color_filter_t
Data for a color filter.
void color_filter_qt_add_cb(color_filter_t *colorf, void *user_data)
Adds a color filter callback to the specified color filter.
RGB color representation with 16-bit precision per channel.
Definition color.h:27