2016-10-21 08:07:26 +01:00
|
|
|
#include "SystemTheme.h"
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QStyle>
|
2016-10-22 00:43:36 +01:00
|
|
|
#include <QStyleFactory>
|
|
|
|
#include <QDebug>
|
2016-10-21 08:07:26 +01:00
|
|
|
|
|
|
|
SystemTheme::SystemTheme()
|
|
|
|
{
|
2016-10-22 00:43:36 +01:00
|
|
|
const auto & style = QApplication::style();
|
|
|
|
systemPalette = style->standardPalette();
|
|
|
|
QString lowerThemeName = style->objectName();
|
|
|
|
qWarning() << systemTheme;
|
|
|
|
QStringList styles = QStyleFactory::keys();
|
|
|
|
for(auto &st: styles)
|
|
|
|
{
|
|
|
|
if(st.toLower() == lowerThemeName)
|
|
|
|
{
|
|
|
|
systemTheme = st;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// fall back to fusion if we can't find the current theme.
|
|
|
|
systemTheme = "Fusion";
|
2016-10-21 08:07:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::id()
|
|
|
|
{
|
|
|
|
return "system";
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::name()
|
|
|
|
{
|
|
|
|
return QObject::tr("System");
|
|
|
|
}
|
|
|
|
|
2016-10-22 00:43:36 +01:00
|
|
|
QString SystemTheme::qtTheme()
|
|
|
|
{
|
|
|
|
return systemTheme;
|
|
|
|
}
|
|
|
|
|
2016-10-21 08:07:26 +01:00
|
|
|
QPalette SystemTheme::colorScheme()
|
|
|
|
{
|
|
|
|
return systemPalette;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::appStyleSheet()
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|