Manual widget tests: Expose setTheme function

...so that it can directly be called if showing the combobox is not wanted.

Change-Id: Id80658336421788749f1a1ec68680fef53ae1695
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Alessandro Portale
2021-05-19 17:51:45 +02:00
parent b04981e482
commit 356eaf1d3f
2 changed files with 9 additions and 3 deletions

View File

@@ -35,9 +35,11 @@
#include <QDir>
#include <QSettings>
namespace ManualTest {
static const char themeNameKey[] = "ThemeName";
static void setTheme(const QString &themeFile)
void ThemeSelector::setTheme(const QString &themeFile)
{
using namespace Utils;
@@ -50,7 +52,7 @@ static void setTheme(const QString &themeFile)
QApplication::setPalette(theme.palette());
}
ManualTest::ThemeSelector::ThemeSelector(QWidget *parent)
ThemeSelector::ThemeSelector(QWidget *parent)
: QComboBox(parent)
{
QCoreApplication::setOrganizationName("QtProject");
@@ -71,3 +73,5 @@ ManualTest::ThemeSelector::ThemeSelector(QWidget *parent)
appSettings.setValue(themeNameKey, currentText());
});
}
} // namespace ManualTest

View File

@@ -32,6 +32,8 @@ namespace ManualTest {
class ThemeSelector : public QComboBox {
public:
ThemeSelector(QWidget *parent = nullptr);
static void setTheme(const QString &themeFile);
};
}
} // namespace ManualTest