|
Wireshark 4.7.2
The Wireshark network protocol analyzer
|
#include <theme_stylesheet_loader.h>
Public Types | |
| using | TokenMap = QHash<ThemeManager::ThemeToken, ThemeColorPair> |
Static Public Member Functions | |
| static QString | load (const QString &name, const TokenMap &tokens, bool isDarkMode) |
Loads a QSS stylesheet from the built-in :/stylesheets/ resource tree and resolves every wstheme(RoleName) token by looking up RoleName in the current theme's color map.
Split out of ThemeManager so the loader logic — stylesheet path sanitization, QSS read, token regex, role-enum lookup — lives alongside the other theme helpers under ui/qt/utils/themes/.
Stateless: every call reads fresh resource contents and resolves tokens against the token map the caller provides. ThemeManager is the usual caller and passes its own themeColors_ / isDarkMode().
|
static |
Load :/stylesheets/<name>.qss and return its contents with:
Returns an empty QString on any of:
Tokens that don't resolve (unknown role name or missing color in the map) are stripped from the output and a qWarning is emitted — Qt's QSS parser is all-or-nothing per object, so leaving a literal wstheme(Foo) in place would silently drop the entire rule on the first typo; stripping keeps the rest of the rules valid and the warning surfaces the typo.
| name | Logical name under :/stylesheets/, without extension (e.g. "widgets/learn-card"). |
| tokens | Current theme's color map. |
| isDarkMode | Which side of color pairs to select. |