Add name() getter in QPlatformTheme
This patch adds a getter for the current platform theme's name. It is populated by QPlatformThemeFactory::create() if a plugin has been loaded successfully. Change-Id: I2c891c46e7dfcc262c35e32e345ae3dc2623e3a5 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
626ec74359
commit
5809c6fffd
@ -850,6 +850,11 @@ unsigned QPlatformThemePrivate::currentKeyPlatforms()
|
||||
return result;
|
||||
}
|
||||
|
||||
QString QPlatformTheme::name() const
|
||||
{
|
||||
return d_func()->name;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qplatformtheme.cpp"
|
||||
|
@ -317,10 +317,14 @@ public:
|
||||
static QVariant defaultThemeHint(ThemeHint hint);
|
||||
static QString defaultStandardButtonText(int button);
|
||||
static QString removeMnemonics(const QString &original);
|
||||
QString name() const;
|
||||
|
||||
protected:
|
||||
explicit QPlatformTheme(QPlatformThemePrivate *priv);
|
||||
QScopedPointer<QPlatformThemePrivate> d_ptr;
|
||||
|
||||
private:
|
||||
friend class QPlatformThemeFactory;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
static unsigned currentKeyPlatforms();
|
||||
|
||||
QPalette *systemPalette;
|
||||
|
||||
QString name;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "qmutex.h"
|
||||
|
||||
#include "qguiapplication.h"
|
||||
#include "qplatformtheme.h"
|
||||
#include "qplatformtheme_p.h"
|
||||
#include "qdebug.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -22,7 +24,10 @@ QPlatformTheme *QPlatformThemeFactory::create(const QString& key, const QString
|
||||
QStringList paramList = key.split(u':');
|
||||
const QString platform = paramList.takeFirst().toLower();
|
||||
loader->setExtraSearchPath(platformPluginPath);
|
||||
return qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(loader(), platform, paramList);
|
||||
QPlatformTheme *theme = qLoadPlugin<QPlatformTheme, QPlatformThemePlugin>(loader(), platform, paramList);
|
||||
if (theme)
|
||||
theme->d_func()->name = key;
|
||||
return theme;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user