Plasma
framesvg.cpp
316 return rect.adjusted(d->frame->leftMargin, d->frame->topMargin, -d->frame->rightMargin, -d->frame->bottomMargin);
429 const QString maskRequestedPrefix = requestedPrefix.isEmpty() ? QStringLiteral("mask") : maskPrefix % requestedPrefix;
460 QSharedPointer<FrameData> FrameSvgPrivate::lookupOrCreateMaskFrame(const QSharedPointer<FrameData> &frame, const QString &maskPrefix, const QString &maskRequestedPrefix)
496 const bool overlayAvailable = !frame->prefix.startsWith(QLatin1String("mask-")) && q->hasElement(frame->prefix % QLatin1String("overlay"));
499 frameCached = q->theme()->findInCache(QString::number(id), frame->cachedBackground, frame->lastModified) && !frame->cachedBackground.isNull();
503 overlayCached = q->theme()->findInCache(QString::number(overlayId), overlay, frame->lastModified) && !overlay.isNull();
543 overlayPainter.drawTiledPixmap(QRect(QPoint(0, 0), overlaySize), q->pixmap(frame->prefix % QLatin1String("overlay")));
546 q->paint(&overlayPainter, QRect(actualOverlayPos, overlaySize), frame->prefix % QLatin1String("overlay"));
575 qCWarning(LOG_PLASMA) << "Not generating frame background for a size whose width or height is more than" << MAX_FRAME_SIZE << size;
595 paintBorder(p, frame, FrameSvg::LeftBorder, QSize(frame->leftWidth, leftHeight) * q->devicePixelRatio(), contentRect);
597 paintBorder(p, frame, FrameSvg::RightBorder, QSize(frame->rightWidth, rightHeight) * q->devicePixelRatio(), contentRect);
600 paintBorder(p, frame, FrameSvg::TopBorder, QSize(topWidth, frame->topHeight) * q->devicePixelRatio(), contentRect);
602 paintBorder(p, frame, FrameSvg::BottomBorder, QSize(bottomWidth, frame->bottomHeight) * q->devicePixelRatio(), contentRect);
608 QRect FrameSvgPrivate::contentGeometry(const QSharedPointer<FrameData> &frame, const QSize& size) const
610 const QSize contentSize(size.width() - frame->leftWidth * q->devicePixelRatio() - frame->rightWidth * q->devicePixelRatio(),
611 size.height() - frame->topHeight * q->devicePixelRatio() - frame->bottomHeight * q->devicePixelRatio());
613 if (frame->enabledBorders & FrameSvg::LeftBorder && q->hasElement(frame->prefix % QLatin1String("left"))) {
618 if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(frame->prefix % QLatin1String("top"))) {
691 void FrameSvgPrivate::paintCenter(QPainter& p, const QSharedPointer<FrameData> &frame, const QRect& contentRect, const QSize& fullSize)
707 p.drawTiledPixmap(FrameSvgHelpers::sectionRect(FrameSvg::NoBorder, contentRect, fullSize * q->devicePixelRatio()), center);
714 q->paint(&p, FrameSvgHelpers::sectionRect(FrameSvg::NoBorder, contentRect, fullSize * q->devicePixelRatio()), centerElementId);
726 void FrameSvgPrivate::paintBorder(QPainter& p, const QSharedPointer<FrameData> &frame, const FrameSvg::EnabledBorders borders, const QSize& size, const QRect& contentRect) const
731 q->paint(&p, FrameSvgHelpers::sectionRect(borders, contentRect, frame->frameSize * q->devicePixelRatio()), side);
740 p.drawTiledPixmap(FrameSvgHelpers::sectionRect(borders, contentRect, frame->frameSize * q->devicePixelRatio()), px);
745 void FrameSvgPrivate::paintCorner(QPainter& p, const QSharedPointer<FrameData> &frame, Plasma::FrameSvg::EnabledBorders border, const QRect& contentRect) const
753 q->paint(&p, FrameSvgHelpers::sectionRect(border, contentRect, frame->frameSize * q->devicePixelRatio()), corner);
757 SvgPrivate::CacheId FrameSvgPrivate::cacheId(FrameData *frame, const QString &prefixToSave) const
760 return SvgPrivate::CacheId{double(size.width()), double(size.height()), frame->imagePath, prefixToSave, q->status(), q->devicePixelRatio(), q->scaleFactor(), q->colorGroup(), (uint)frame->enabledBorders, q->Svg::d->lastModified};
763 void FrameSvgPrivate::cacheFrame(const QString &prefixToSave, const QPixmap &background, const QPixmap &overlay)
778 q->theme()->insertIntoCache(QString::number(id), background, QString::number((qint64)q, 16) % prefixToSave);
783 q->theme()->insertIntoCache(QString::number(overlayId), overlay, QString::number((qint64)q, 16) % prefixToSave % QLatin1String("overlay"));
802 frame->fixedTopMargin = q->elementSize(frame->prefix % QLatin1String("hint-top-margin")).height();
816 frame->insetTopMargin = q->elementSize(frame->prefix % QLatin1String("hint-top-inset")).height();
824 frame->fixedLeftMargin = q->elementSize(frame->prefix % QLatin1String("hint-left-margin")).width();
837 frame->insetLeftMargin = q->elementSize(frame->prefix % QLatin1String("hint-left-inset")).width();
845 frame->fixedRightMargin = q->elementSize(frame->prefix % QLatin1String("hint-right-margin")).width();
858 frame->insetRightMargin = q->elementSize(frame->prefix % QLatin1String("hint-right-inset")).width();
866 frame->fixedBottomMargin = q->elementSize(frame->prefix % QLatin1String("hint-bottom-margin")).height();
879 frame->insetBottomMargin = q->elementSize(frame->prefix % QLatin1String("hint-bottom-inset")).height();
884 frame->composeOverBorder = (q->hasElement(frame->prefix % QLatin1String("hint-compose-over-border")) &&
889 frame->tileCenter = (q->hasElement(QStringLiteral("hint-tile-center")) || q->hasElement(frame->prefix % QLatin1String("hint-tile-center")));
890 frame->noBorderPadding = (q->hasElement(QStringLiteral("hint-no-border-padding")) || q->hasElement(frame->prefix % QLatin1String("hint-no-border-padding")));
891 frame->stretchBorders = (q->hasElement(QStringLiteral("hint-stretch-borders")) || q->hasElement(frame->prefix % QLatin1String("hint-stretch-borders")));
Q_INVOKABLE void paintFrame(QPainter *painter, const QRectF &target, const QRectF &source=QRectF())
Paints the loaded SVG with the elements that represents the border.
Definition: framesvg.cpp:385
Q_INVOKABLE QRegion mask() const
Returns a mask that tightly contains the fully opaque areas of the svg.
Definition: framesvg.cpp:328
FrameSvg(QObject *parent=nullptr)
Constructs a new FrameSvg that paints the proper named subelements as borders.
Definition: framesvg.cpp:41
bool isValid() const const
void setHeight(int height)
Q_INVOKABLE void setCacheAllRenderedFrames(bool cache)
Sets whether saving all the rendered prefixes in a cache or not.
Definition: framesvg.cpp:350
QHash::iterator insert(const Key &key, const T &value)
int width() const const
bool end()
void setCompositionMode(QPainter::CompositionMode mode)
void repaintNeeded()
Emitted whenever the SVG data has changed in such a way that a repaint is required.
void setRenderHint(QPainter::RenderHint hint, bool on)
Q_INVOKABLE qreal fixedMarginSize(const Plasma::Types::MarginEdge edge) const
Returns the margin size given the margin edge we want.
Definition: framesvg.cpp:247
void fill(const QColor &color)
void setRepaintBlocked(bool blocked)
If we will do several changes at once in the frame properties, such as prefix, enabled borders and si...
Definition: framesvg.cpp:940
bool isEmpty() const const
Q_INVOKABLE void getFixedMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const
Convenience method that extracts the size of the four margins in the four output parameters Compared ...
Definition: framesvg.cpp:286
void drawTiledPixmap(const QRectF &rectangle, const QPixmap &pixmap, const QPointF &position)
bool isNull() const const
Q_INVOKABLE qreal marginSize(const Plasma::Types::MarginEdge edge) const
Returns the margin size given the margin edge we want If the given margin is disabled, it will return 0.
Definition: framesvg.cpp:195
Q_INVOKABLE bool hasElement(const QString &elementId) const
Check whether an element exists in the loaded SVG.
Definition: svg.cpp:1044
QString number(int n, int base)
bool isEmpty() const const
Q_INVOKABLE void resizeFrame(const QSizeF &size)
Resize the frame maintaining the same border size.
Definition: framesvg.cpp:163
QSize toSize() const const
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
void setWidth(int width)
Q_INVOKABLE bool hasElementPrefix(const QString &prefix) const
Definition: framesvg.cpp:128
bool isEmpty() const const
Q_INVOKABLE QString prefix()
Returns the prefix for SVG elements of the FrameSvg (including a '-' at the end if not empty) ...
Definition: framesvg.cpp:158
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const const
Q_INVOKABLE void setElementPrefix(Plasma::Types::Location location)
Sets the prefix (.
Definition: framesvg.cpp:86
int remove(const Key &key)
const T value(const Key &key) const const
CompositionMode_SourceIn
bool isNull() const const
KCALENDARCORE_EXPORT uint qHash(const KCalendarCore::Period &key)
bool isEmpty() const const
void setContainsMultipleImages(bool multiple)
Set whether the SVG contains a single image or multiple ones.
Definition: svg.cpp:1073
Q_INVOKABLE void clearCache()
Deletes the internal cache freeing memory: use this if you want to switch the rendered element and yo...
Definition: framesvg.cpp:364
bool isValid() const const
if(recurs()&&!first)
Q_INVOKABLE bool cacheAllRenderedFrames() const
Definition: framesvg.cpp:359
Q_INVOKABLE QPixmap framePixmap()
Returns a pixmap of the SVG represented by this object.
Definition: framesvg.cpp:376
EnabledBorders enabledBorders() const
Convenience method to get the enabled borders.
Q_INVOKABLE void setImagePath(const QString &path) override
Loads a new Svg.
Definition: framesvg.cpp:53
int height() const const
Q_INVOKABLE qreal insetSize(const Plasma::Types::MarginEdge edge) const
Returns the insets margin size given the margin edge we want.
Definition: framesvg.cpp:221
Q_INVOKABLE void getInset(qreal &left, qreal &top, qreal &right, qreal &bottom) const
Convenience method that extracts the size of the four inset margins in the four output parameters...
Definition: framesvg.cpp:299
void setX(int x)
void setY(int y)
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const const
Q_INVOKABLE void 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 The disab...
Definition: framesvg.cpp:273
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition: plasma.h:153
transparent
SmoothPixmapTransform
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Q_EMITQ_EMIT
void setEnabledBorders(const EnabledBorders borders)
Sets what borders should be painted.
Definition: framesvg.cpp:68
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 22:40:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 22:40:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.