2016-10-21 12:37:26 +05:30
|
|
|
#include "SystemTheme.h"
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QStyle>
|
2016-10-22 05:13:36 +05:30
|
|
|
#include <QStyleFactory>
|
|
|
|
#include <QDebug>
|
2016-10-21 12:37:26 +05:30
|
|
|
|
|
|
|
SystemTheme::SystemTheme()
|
|
|
|
{
|
2016-10-22 05:13:36 +05:30
|
|
|
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 12:37:26 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::id()
|
|
|
|
{
|
|
|
|
return "system";
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::name()
|
|
|
|
{
|
|
|
|
return QObject::tr("System");
|
|
|
|
}
|
|
|
|
|
2016-10-22 05:13:36 +05:30
|
|
|
QString SystemTheme::qtTheme()
|
|
|
|
{
|
|
|
|
return systemTheme;
|
|
|
|
}
|
|
|
|
|
2016-10-21 12:37:26 +05:30
|
|
|
QPalette SystemTheme::colorScheme()
|
|
|
|
{
|
|
|
|
return systemPalette;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::appStyleSheet()
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|