Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
themed_icon.h
Go to the documentation of this file.
1
9
10#pragma once
11
14
15#include <QIcon>
16#include <QPalette>
17#include <QSize>
18#include <QString>
19
40class ThemedIcon : public QIcon
41{
42public:
49 explicit ThemedIcon(const QString &svg_resource_path,
50 ThemeManager::ThemeToken token,
51 QSize size = QSize(14, 14));
52
58 explicit ThemedIcon(const char *name) :
59 ThemedIcon(QString::fromUtf8(name))
60 {
61 }
62
68 explicit ThemedIcon(const QString &name)
69 {
70 *this = ThemedIcon(QStringLiteral(":/svg_icons/") + name + QStringLiteral(".svg"),
71 ThemeManager::PaletteText);
72 }
73
85 explicit ThemedIcon(const QString &svg_resource_path,
86 ThemeManager::ThemeToken token,
87 ThemeManager::ThemeToken active_token,
88 ThemeManager::ThemeToken selected_token = ThemeManager::NoRole,
89 QSize size = QSize(14, 14));
90
97 void setPalette(const QPalette &palette);
98
99private:
100 // Private delegate: the engine shares @p palette so setPalette() can reach it.
101 ThemedIcon(const QString &svg_resource_path,
102 ThemeManager::ThemeToken token,
103 ThemeManager::ThemeToken active_token,
104 ThemeManager::ThemeToken selected_token,
105 QSize size, IconPaletteRef palette);
106
107 IconPaletteRef palette_;
108};
ThemedIcon(const QString &svg_resource_path, ThemeManager::ThemeToken token, QSize size=QSize(14, 14))
Definition themed_icon.cpp:156
void setPalette(const QPalette &palette)
Set a custom palette for drawing this icon instead of the application palette.
Definition themed_icon.cpp:183
ThemedIcon(const char *name)
Convenience constructor for creating a themed icon from a stock name.
Definition themed_icon.h:58
ThemedIcon(const QString &name)
Convenience constructor for creating a themed icon from a stock name.
Definition themed_icon.h:68
std::shared_ptr< std::optional< QPalette > > IconPaletteRef
Palette override shared between an icon object and its engine, so that ThemedIcon::setPalette() / Con...
Definition token_palette.h:28