| 928 | } |
| 929 | |
| 930 | QColor ThemeManager::factoryColor(const QString& token) const |
| 931 | { |
| 932 | ensureFactoryLoaded(); |
| 933 | const auto it = m_factoryTokens.constFind(token); |
| 934 | if (it == m_factoryTokens.constEnd()) return QColor(); |
| 935 | if (it.value().canConvert<ThemeGradient>()) { |
| 936 | // Token is a gradient in the factory baseline — graceful fallback |
| 937 | // to the first stop's colour, matching ThemeManager::color()'s |
| 938 | // behaviour for gradient tokens. |
| 939 | const auto g = it.value().value<ThemeGradient>(); |
| 940 | if (g.stops.isEmpty()) return QColor(); |
| 941 | return g.stops.first().color; |
| 942 | } |
| 943 | if (it.value().userType() != QMetaType::QString) return QColor(); |
| 944 | return QColor(it.value().toString()); |
| 945 | } |
| 946 | |
| 947 | int ThemeManager::factorySizing(const QString& token) const |
| 948 | { |