libplasma
Plasma::PanelSvg Class Reference
#include <panelsvg.h>

Detailed Description
Definition at line 46 of file panelsvg.h.
Public Types | |
enum | EnabledBorder { NoBorder = 0, TopBorder = 1, BottomBorder = 2, LeftBorder = 4, RightBorder = 8, AllBorders } |
Public Member Functions | |
bool | cacheAllRenderedPanels () const |
void | clearCache () |
EnabledBorders | enabledBorders () const |
void | getMargins (qreal &left, qreal &top, qreal &right, qreal &bottom) const |
bool | hasElementPrefix (Plasma::Location location) const |
bool | hasElementPrefix (const QString &prefix) const |
qreal | marginSize (const Plasma::MarginEdge edge) const |
QBitmap | mask () const |
Q_INVOKABLE void | paintPanel (QPainter *painter, const QRectF &rect, const QPointF &pos=QPointF(0, 0)) |
QSizeF | panelSize () const |
QString | prefix () |
void | resizePanel (const QSizeF &size) |
void | setCacheAllRenderedPanels (bool cache) |
void | setElementPrefix (const QString &prefix) |
void | setElementPrefix (Plasma::Location location) |
void | setEnabledBorders (const EnabledBorders borders) |
void | setImagePath (const QString &path) |
~PanelSvg () | |
Related Functions | |
(Note that these are not member functions.) | |
PanelSvg (QObject *parent=0) |
Member Enumeration Documentation
Constructor & Destructor Documentation
Plasma::PanelSvg::~PanelSvg | ( | ) |
Definition at line 114 of file panelsvg.cpp.
Member Function Documentation
bool Plasma::PanelSvg::cacheAllRenderedPanels | ( | ) | const |
- Returns:
- if all the different prefixes should be kept in a cache when rendered
Definition at line 333 of file panelsvg.cpp.
void Plasma::PanelSvg::clearCache | ( | ) |
Deletes the internal cache freeing memory: use this if you want to switch the rendered element and you don't plan to switch back to the previous one for a long time and you used setUseCache(true).
Definition at line 338 of file panelsvg.cpp.
PanelSvg::EnabledBorders Plasma::PanelSvg::enabledBorders | ( | ) | const |
Convenience method to get the enabled borders.
- Returns:
- what borders are painted
Definition at line 141 of file panelsvg.cpp.
void Plasma::PanelSvg::getMargins | ( | qreal & | left, | |
qreal & | top, | |||
qreal & | right, | |||
qreal & | bottom | |||
) | const |
Convenience method that extracts the size of the four margins in the four output parameters.
- left left margin size
- top top margin size
- right right margin size
- bottom bottom margin size
Definition at line 298 of file panelsvg.cpp.
bool Plasma::PanelSvg::hasElementPrefix | ( | Plasma::Location | location | ) | const |
This is an overloaded method provided for convenience equivalent to hasElementPrefix("north"), hasElementPrefix("south") hasElementPrefix("west") and hasElementPrefix("east").
- Returns:
- true if the svg has the necessary elements with the given prefix to draw a panel.
- location the given prefix we want to check if drawable
Definition at line 216 of file panelsvg.cpp.
bool Plasma::PanelSvg::hasElementPrefix | ( | const QString & | prefix | ) | const |
- Returns:
- true if the svg has the necessary elements with the given prefix to draw a panel
- prefix the given prefix we want to check if drawable
Definition at line 205 of file panelsvg.cpp.
qreal Plasma::PanelSvg::marginSize | ( | const Plasma::MarginEdge | edge | ) | const |
Returns the margin size given the margin edge we want.
- edge the margin edge we want, top, bottom, left or right
- Returns:
- the margin size
Definition at line 272 of file panelsvg.cpp.
QBitmap Plasma::PanelSvg::mask | ( | ) | const |
Returns a monochrome mask that tightly contains the fully opaque areas of the svg.
- Returns:
- a monochrome bitmap of opaque areas
Definition at line 313 of file panelsvg.cpp.
void Plasma::PanelSvg::paintPanel | ( | QPainter * | painter, | |
const QRectF & | rect, | |||
const QPointF & | pos = QPointF(0, 0) | |||
) |
Paints the loaded SVG with the elements that represents the border.
- painter the QPainter to use
- rect the exposed rect to draw into
Definition at line 353 of file panelsvg.cpp.
QSizeF Plasma::PanelSvg::panelSize | ( | ) | const |
QString Plasma::PanelSvg::prefix | ( | ) |
Returns the prefix for SVG elements of the PanelSvg.
- Returns:
- the prefix
Definition at line 237 of file panelsvg.cpp.
void Plasma::PanelSvg::resizePanel | ( | const QSizeF & | size | ) |
Resize the panel maintaining the same border size.
- size the new size of the panel
Definition at line 246 of file panelsvg.cpp.
void Plasma::PanelSvg::setCacheAllRenderedPanels | ( | bool | cache | ) |
Sets whether saving all the rendered prefixes in a cache or not.
- cache if use the cache or not
Definition at line 324 of file panelsvg.cpp.
void Plasma::PanelSvg::setElementPrefix | ( | const QString & | prefix | ) |
Sets the prefix for the SVG elements to be used for painting.
For example, if prefix is 'active', then instead of using the 'top' element of the SVG file to paint the top border, 'active-top' element will be used. The same goes for other SVG elements.
If the elements with prefixes are not present, the default ones are used. (for the sake of speed, the test is present only for the 'center' element)
Setting the prefix manually resets the location to Floating. If the
- prefix prefix for the SVG element names
Definition at line 174 of file panelsvg.cpp.
void Plasma::PanelSvg::setElementPrefix | ( | Plasma::Location | location | ) |
Sets the prefix (.
- See also:
- setElementPrefix) to 'north', 'south', 'west' and 'east' when the location is TopEdge, BottomEdge, LeftEdge and RightEdge, respectively. Clears the prefix in other cases.
- location location
Definition at line 152 of file panelsvg.cpp.
void Plasma::PanelSvg::setEnabledBorders | ( | const EnabledBorders | borders | ) |
Sets what borders should be painted.
- flags borders we want to paint
Definition at line 131 of file panelsvg.cpp.
void Plasma::PanelSvg::setImagePath | ( | const QString & | path | ) |
Loads a new Svg.
- imagePath the new file
Reimplemented from Plasma::Svg.
Definition at line 119 of file panelsvg.cpp.
Friends And Related Function Documentation
Plasma::PanelSvg::PanelSvg | ( | QObject * | parent = 0 |
) | [related] |
Constructs a new PanelSvg that paints the proper named subelements as borders.
It may also be used as a regular Plasma::Svg object for direct access to elements in the Svg.
- parent options QObject to parent this to
Definition at line 106 of file panelsvg.cpp.
The documentation for this class was generated from the following files: