mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
this can be used in qss selectors
This commit is contained in:
committed by
Mathew Sutcliffe
parent
197560c3c3
commit
7907dff967
@@ -43,6 +43,7 @@
|
||||
#include <QStyleFactory>
|
||||
#include <QStringList>
|
||||
#include <QStyle>
|
||||
#include <QSysInfo>
|
||||
#include <QUrl>
|
||||
#include <QWidget>
|
||||
#include <QMainWindow>
|
||||
@@ -181,6 +182,7 @@ namespace BlackGui
|
||||
mainWindow->setWindowTitle(name);
|
||||
mainWindow->setWindowIcon(m_windowIcon);
|
||||
mainWindow->setWindowIconText(name);
|
||||
CStyleSheetUtility::setQSysInfoProperties(CGuiApplication::mainApplicationWindow(), true);
|
||||
emit uiObjectTreeReady();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -138,6 +138,9 @@ namespace BlackGui
|
||||
//! Concatenate 2 styles
|
||||
static QString concatStyles(const QString &style1, const QString &style2);
|
||||
|
||||
//! Set QSysInfo properties for given widget (which can be used in stylesheet)
|
||||
static void setQSysInfoProperties(QWidget *widget, bool withChildWidgets);
|
||||
|
||||
signals:
|
||||
//! Sheets have been changed
|
||||
//! \deprecated use BlackGui::CGuiApplication::styleSheetsChanged
|
||||
|
||||
Reference in New Issue
Block a user