refs #935, refs #936 utility function to set OS specific properties

this can be used in qss selectors
This commit is contained in:
Klaus Basan
2017-04-15 23:07:23 +02:00
committed by Mathew Sutcliffe
parent 197560c3c3
commit 7907dff967
3 changed files with 25 additions and 0 deletions

View File

@@ -411,6 +411,26 @@ namespace BlackGui
return s1;
}
void CStyleSheetUtility::setQSysInfoProperties(QWidget *widget, bool withChildWidgets)
{
Q_ASSERT_X(widget, Q_FUNC_INFO, "Missing widget");
if (!widget->property("qsysKernelType").isValid())
{
widget->setProperty("qsysKernelType", QSysInfo::kernelType());
widget->setProperty("qsysCurrentCpuArchitecture", QSysInfo::currentCpuArchitecture());
widget->setProperty("qsysBuildCpuArchitecture", QSysInfo::buildCpuArchitecture());
widget->setProperty("qsysProductType", QSysInfo::productType());
}
if (withChildWidgets)
{
for (QWidget *w : widget->findChildren<QWidget *>(QString(), Qt::FindDirectChildrenOnly))
{
CStyleSheetUtility::setQSysInfoProperties(w, true);
}
}
}
void CStyleSheetUtility::ps_qssDirectoryChanged(const QString &file)
{
Q_UNUSED(file);