KDEGames
kgamethemeprovider.cpp
112 Q_ASSERT_X(d->m_currentTheme == nullptr || d->m_inRediscover, "KGameThemeProvider::addTheme", "Only allowed before currentTheme() is called.");
179void KGameThemeProvider::discoverThemes(const QString &directory, const QString &defaultThemeName, const QMetaObject *themeClass)
222 const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, d->m_dtDirectory, QStandardPaths::LocateDirectory);
253 theme = qobject_cast<KGameTheme *>(d->m_dtThemeClass->newInstance(Q_ARG(QByteArray, id), Q_ARG(QObject *, this)));
254 Q_ASSERT_X(theme, "KGameThemeProvider::discoverThemes", "Could not create theme instance. Is your constructor Q_INVOKABLE?");
289 QPixmap pixmap = QPixmap(theme->previewPath()).scaled(size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation);
A theme provider manages KGameTheme instances, and maintains a selection of the currentTheme().
Definition kgamethemeprovider.h:31
QList< const KGameTheme * > themes() const
Definition kgamethemeprovider.cpp:97
void currentThemeChanged(const KGameTheme *theme)
Emitted when the current theme changes.
void rediscoverThemes()
After this provider has been set up with discoverThemes(), this method may be used to read additional...
Definition kgamethemeprovider.cpp:208
void discoverThemes(const QString &directory, const QString &defaultThemeName=QStringLiteral("default"), const QMetaObject *themeClass=nullptr)
This method reads theme description files from a standard location.
Definition kgamethemeprovider.cpp:179
virtual QPixmap generatePreview(const KGameTheme *theme, QSize size)
Generate a preview pixmap for the given theme.
Definition kgamethemeprovider.cpp:286
void currentThemeNameChanged(const QString &themeName)
Emitted when the name of the current theme changes.
void setDefaultTheme(const KGameTheme *theme)
Definition kgamethemeprovider.cpp:125
void setDeclarativeEngine(const QString &name, QQmlEngine *engine)
Registers this KGameThemeProvider with engine's root context with ID name and constructs a KGameImage...
Definition kgamethemeprovider.cpp:294
void setCurrentTheme(const KGameTheme *theme)
Select a new theme.
Definition kgamethemeprovider.cpp:161
const KGameTheme * defaultTheme() const
Definition kgamethemeprovider.cpp:118
KGameThemeProvider(const QByteArray &configKey=QByteArrayLiteral("Theme"), QObject *parent=nullptr)
Constructor.
Definition kgamethemeprovider.cpp:57
virtual bool readFromDesktopFile(const QString &path)
Initializes a KGameTheme instance by reading a description file.
Definition kgametheme.cpp:104
Dirs
QStringList entryList(Filters filters, SortFlags sort) const const
void append(QList< T > &&value)
qsizetype count() const const
bool isEmpty() const const
void prepend(parameter_type value)
void reserve(qsizetype size)
qsizetype size() const const
T value(qsizetype i) const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
T qobject_cast(QObject *object)
void setParent(QObject *parent)
QPixmap scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const const
void setDevicePixelRatio(qreal scaleFactor)
void setContextProperty(const QString &name, QObject *value)
void addImageProvider(const QString &providerId, QQmlImageProviderBase *provider)
QQmlContext * rootContext() const const
LocateDirectory
AppDataLocation
QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options)
QByteArray toUtf8() const const
KeepAspectRatio
SmoothTransformation
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Apr 27 2024 22:10:38 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Apr 27 2024 22:10:38 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.