Plasma
Plasma::Theme Class Reference
Interface to the Plasma theme. More...
#include <Plasma/Theme>

Public Types | |
enum | ColorRole { TextColor = 0, HighlightColor = 1, BackgroundColor = 2, ButtonTextColor = 4, ButtonBackgroundColor = 8 } |
enum | FontRole { DefaultFont = 0, DesktopFont } |
Public Slots | |
void | settingsChanged () |
Signals | |
void | themeChanged () |
Public Member Functions | |
Q_INVOKABLE QColor | color (ColorRole role) const |
Q_INVOKABLE KSharedConfigPtr | colorScheme () const |
Q_INVOKABLE bool | currentThemeHasImage (const QString &name) const |
bool | findInCache (const QString &key, QPixmap &pix) |
bool | findInRectsCache (const QString &image, const QString &element, QRectF &rect) const |
Q_INVOKABLE QFont | font (FontRole role) const |
Q_INVOKABLE QFontMetrics | fontMetrics () const |
Q_INVOKABLE QString | imagePath (const QString &name) const |
void | insertIntoCache (const QString &key, const QPixmap &pix) |
void | insertIntoRectsCache (const QString &image, const QString &element, const QRectF &rect) |
void | invalidateRectsCache (const QString &image) |
void | releaseRectsCache (const QString &image) |
void | setCacheLimit (int kbytes) |
Q_INVOKABLE void | setFont (const QFont &font, FontRole role=DefaultFont) |
void | setThemeName (const QString &themeName) |
void | setUseGlobalSettings (bool useGlobal) |
Theme (QObject *parent=0) | |
QString | themeName () const |
bool | useGlobalSettings () const |
Q_INVOKABLE QString | wallpaperPath (const QSize &size=QSize()) const |
Q_INVOKABLE bool | windowTranslucencyEnabled () const |
~Theme () | |
Static Public Member Functions | |
static Theme * | defaultTheme () |
static PackageStructure::Ptr | packageStructure () |
Properties | |
QString | themeName |
Detailed Description
Interface to the Plasma theme.Accessed via Plasma::Theme::defaultTheme() e.g:
QString imagePath = Plasma::Theme::defaultTheme()->imagePath("widgets/clock")
Plasma::Theme provides access to a common and standardized set of graphic elements stored in SVG format. This allows artists to create single packages of SVGs that will affect the look and feel of all workspace components.
Plasma::Svg uses Plasma::Theme internally to locate and load the appropriate SVG data. Alternatively, Plasma::Theme can be used directly to retrieve file system paths to SVGs by name.
Definition at line 55 of file theme.h.
Member Enumeration Documentation
Constructor & Destructor Documentation
Plasma::Theme::Theme | ( | QObject * | parent = 0 |
) | [explicit] |
Member Function Documentation
KSharedConfigPtr Plasma::Theme::colorScheme | ( | ) | const |
bool Plasma::Theme::currentThemeHasImage | ( | const QString & | name | ) | const |
Theme * Plasma::Theme::defaultTheme | ( | ) | [static] |
bool Plasma::Theme::findInRectsCache | ( | const QString & | image, | |
const QString & | element, | |||
QRectF & | rect | |||
) | const |
Tries to load the rect of a sub element from a disk cache.
- image path of the image we want to check
- element sub element we want to retrieve
- rect output parameter of the element rect found in cache if not found or if we are sure it doesn't exist it will be QRect()
- Returns:
- true if the element was found in cache or if we are sure the element doesn't exist
QFontMetrics Plasma::Theme::fontMetrics | ( | ) | const |
void Plasma::Theme::invalidateRectsCache | ( | const QString & | image | ) |
PackageStructure::Ptr Plasma::Theme::packageStructure | ( | ) | [static] |
void Plasma::Theme::releaseRectsCache | ( | const QString & | image | ) |
Frees up memory used by cached information for a given image without removing the permenant record of it on disk.
- See also:
- invalidateRectsCache
- image the path to the image the cache is assoiated with
void Plasma::Theme::setCacheLimit | ( | int | kbytes | ) |
Sets the maximum size of the cache (in kilobytes).
If cache gets bigger the limit then some entries are removed Setting cache limit to 0 disables automatic cache size limiting.
Note that the cleanup might not be done immediately, so the cache might temporarily (for a few seconds) grow bigger than the limit.
void Plasma::Theme::setThemeName | ( | const QString & | themeName | ) |
void Plasma::Theme::settingsChanged | ( | ) | [slot] |
void Plasma::Theme::setUseGlobalSettings | ( | bool | useGlobal | ) |
void Plasma::Theme::themeChanged | ( | ) | [signal] |
Emitted when the user changes the theme.
SVGs should be reloaded at that point
QString Plasma::Theme::themeName | ( | ) | const |
- Returns:
- the name of the theme.
bool Plasma::Theme::useGlobalSettings | ( | ) | const |
bool Plasma::Theme::windowTranslucencyEnabled | ( | ) | const |
Property Documentation
The documentation for this class was generated from the following files: