Public Types |
| enum | ColorRole {
TextColor = 0,
HighlightColor = 1,
BackgroundColor = 2,
ButtonTextColor = 4,
ButtonBackgroundColor = 8,
LinkColor = 16,
VisitedLinkColor = 32,
ButtonHoverColor = 64,
ButtonFocusColor = 128,
ViewTextColor = 256,
ViewBackgroundColor = 512,
ViewHoverColor = 1024,
ViewFocusColor = 2048
} |
| enum | FontRole { DefaultFont = 0,
DesktopFont,
SmallestFont
} |
Public Slots |
| void | settingsChanged () |
Signals |
| void | themeChanged () |
Public Member Functions |
| | Theme (QObject *parent=0) |
| | Theme (const QString &themeName, QObject *parent=0) |
| | ~Theme () |
| Q_INVOKABLE QString | animationPath (const QString &name) const |
| 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 | findInCache (const QString &key, QPixmap &pix, unsigned int lastModified) |
| bool | findInRectsCache (const QString &image, const QString &element, QRectF &rect) const |
| Q_INVOKABLE QFont | font (FontRole role) const |
| Q_INVOKABLE QFontMetrics | fontMetrics () const |
| KUrl | homepage () const |
| Q_INVOKABLE QString | imagePath (const QString &name) const |
| void | insertIntoCache (const QString &key, const QPixmap &pix) |
| void | insertIntoCache (const QString &key, const QPixmap &pix, const QString &id) |
| void | insertIntoRectsCache (const QString &image, const QString &element, const QRectF &rect) |
| void | invalidateRectsCache (const QString &image) |
| QStringList | listCachedRectKeys (const QString &image) const |
| 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) |
| Q_INVOKABLE QString | styleSheet (const QString &css=QString()) const |
| QString | themeName () const |
| bool | useGlobalSettings () const |
| bool | useNativeWidgetStyle () const |
| Q_INVOKABLE QString | wallpaperPath (const QSize &size=QSize()) const |
| Q_INVOKABLE bool | windowTranslucencyEnabled () const |
Static Public Member Functions |
| static Theme * | defaultTheme () |
| static KPluginInfo::List | listThemeInfo () |
| static PackageStructure::Ptr | packageStructure () |
Properties |
| QString | themeName |
Interface to the Plasma theme.
Accessed via Plasma::Theme::defaultTheme() e.g:
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 36 of file theme.h.
| void Plasma::Theme::insertIntoCache |
( |
const QString & |
key, |
|
|
const QPixmap & |
pix, |
|
|
const QString & |
id |
|
) |
| |
Insert specified pixmap into the cache.
If the cache already contains pixmap with the specified key then it is overwritten. The actual insert is delayed for optimization reasons and the id parameter is used to discard repeated inserts in the delay time, useful when for instance the graphics to inser comes from a quickly resizing object: the frames between the start and destination sizes aren't useful in the cache and just cause overhead.
- Parameters:
-
| key | the name to use in the cache for this pixmap |
| pix | the pixmap data to store in the cache |
| id | a name that identifies the caller class of this function in an unique fashion. This is needed to limit disk writes of the cache. If an image with the same id changes quickly, only the last size where insertIntoCache was called is actually stored on disk |
- Since:
- 4.3
Definition at line 950 of file theme.cpp.
| 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.
Definition at line 1067 of file theme.cpp.
| QString Plasma::Theme::styleSheet |
( |
const QString & |
css = QString() | ) |
const |
Provides a Plasma::Theme-themed stylesheet for hybrid (web / native Plasma) widgets.
You can use this method to retrieve a basic default stylesheet, or to theme your custom stylesheet you use for example in Plasma::WebView. The QString you can pass into this method does not have to be a valid stylesheet, in fact you can use this method to replace color placeholders with the theme's color in any QString.
In order to use this method with a custom stylesheet, just put for example textcolor in your QString and it will be replaced with the theme's text (or foreground) color.
Just like in many other methods for retrieving theme information, do not forget to update your stylesheet upon the themeChanged() signal.
The following tags will be replaced by corresponding colors from Plasma::Theme:
textcolor backgroundcolor buttonbackgroundcolor
link activatedlink hoveredlink visitedlink
fontfamily fontsize smallfontsize
- Parameters:
-
| css | a stylesheet to theme, leave empty for a default stylesheet containing theming for some commonly used elements, body text and links, for example. |
- Returns:
- a piece of CSS that sets the most commonly used style elements to a theme matching Plasma::Theme.
- Since:
- 4.5
Definition at line 725 of file theme.cpp.