KSvg
framesvgitem.cpp
58 const QSize contentSize(size.width() - leftWidth - rightWidth, size.height() - topHeight - bottomHeight);
81 FrameItemNode(FrameSvgItem *frameSvg, FrameSvg::EnabledBorders borders, FitMode fitMode, QSGNode *parent)
90 if (m_border == FrameSvg::TopBorder || m_border == FrameSvg::BottomBorder || m_border == FrameSvg::NoBorder) {
92 static_cast<QSGOpaqueTextureMaterial *>(opaqueMaterial())->setHorizontalWrapMode(QSGTexture::Repeat);
94 if (m_border == FrameSvg::LeftBorder || m_border == FrameSvg::RightBorder || m_border == FrameSvg::NoBorder) {
96 static_cast<QSGOpaqueTextureMaterial *>(opaqueMaterial())->setVerticalWrapMode(QSGTexture::Repeat);
101 QString elementId = m_frameSvg->frameSvg()->actualPrefix() + FrameSvgHelpers::borderToElementId(m_border);
120 setTexture(s_cache->loadTexture(m_frameSvg->window(), m_frameSvg->frameSvg()->image(size, elementId), options));
140 if (m_border == FrameSvg::TopBorder || m_border == FrameSvg::BottomBorder || m_border == FrameSvg::NoBorder) {
141 // cmp. CSS3's border-image-repeat: "repeat", though with first tile not centered, but aligned to left
145 if (m_border == FrameSvg::LeftBorder || m_border == FrameSvg::RightBorder || m_border == FrameSvg::NoBorder) {
146 // cmp. CSS3's border-image-repeat: "repeat", though with first tile not centered, but aligned to top
294 connect(m_frameSvg, &Svg::fromCurrentImageSetChanged, this, &FrameSvgItem::fromCurrentImageSetChanged);
340 setImplicitWidth(m_frameSvg->marginSize(KSvg::FrameSvg::LeftMargin) + m_frameSvg->marginSize(KSvg::FrameSvg::RightMargin));
344 setImplicitHeight(m_frameSvg->marginSize(KSvg::FrameSvg::TopMargin) + m_frameSvg->marginSize(KSvg::FrameSvg::BottomMargin));
385 setImplicitWidth(m_frameSvg->marginSize(KSvg::FrameSvg::LeftMargin) + m_frameSvg->marginSize(KSvg::FrameSvg::RightMargin));
389 setImplicitHeight(m_frameSvg->marginSize(KSvg::FrameSvg::TopMargin) + m_frameSvg->marginSize(KSvg::FrameSvg::BottomMargin));
544 setImplicitWidth(m_frameSvg->marginSize(KSvg::FrameSvg::LeftMargin) + m_frameSvg->marginSize(KSvg::FrameSvg::RightMargin));
548 setImplicitHeight(m_frameSvg->marginSize(KSvg::FrameSvg::TopMargin) + m_frameSvg->marginSize(KSvg::FrameSvg::BottomMargin));
554 bool hasComposeOverBorder = m_frameSvg->hasElement(prefix % QLatin1String("hint-compose-over-border"))
603 FrameItemNode::FitMode borderFitMode = stretchBorders ? FrameItemNode::Stretch : FrameItemNode::Tile;
604 FrameItemNode::FitMode centerFitMode = tileCenter ? FrameItemNode::Tile : FrameItemNode::Stretch;
608 new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, oldNode);
611 new FrameItemNode(this, FrameSvg::TopBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, oldNode);
620 new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::LeftBorder, FrameItemNode::FastStretch, oldNode);
623 new FrameItemNode(this, FrameSvg::BottomBorder | FrameSvg::RightBorder, FrameItemNode::FastStretch, oldNode);
664 if ((m_textureChanged || m_sizeChanged) || textureNode->texture()->textureSize() != m_frameSvg->size()) {
685 m_kirigamiTheme = qobject_cast<Kirigami::Platform::PlatformTheme *>(qmlAttachedPropertiesObject<Kirigami::Platform::PlatformTheme>(this, true));
687 qCWarning(LOG_KSVGQML) << "no theme!" << qmlAttachedPropertiesObject<Kirigami::Platform::PlatformTheme>(this, true) << this;
729 const auto newDevicePixelRatio = std::max<qreal>(1.0, (window() ? window()->devicePixelRatio() : qApp->devicePixelRatio()));
761 // this setElementPrefix is done to keep the same behavior as before, when it was a simple string
769void FrameSvgItem::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
Helps to manage textures by creating images and reference counts them.
Definition imagetexturescache.h:29
QList< qreal > margins() const
returns a vector with left, top, right, bottom
Definition framesvgitem.cpp:235
qreal vertical
This property holds the combined width of the top and bottom margins.
Definition framesvgitem.h:74
qreal horizontal
This property holds the combined width of the left and right margins.
Definition framesvgitem.h:68
Q_INVOKABLE bool hasElementPrefix(const QString &prefix) const
Definition framesvgitem.cpp:488
QString imagePath
This property specifies the relative path of the SVG in the theme.
Definition framesvgitem.h:125
Q_INVOKABLE bool hasElement(const QString &elementName) const
Definition framesvgitem.cpp:493
QString usedPrefix
This property holds the actual prefix that was used, if a fallback chain array was set as "prefix".
Definition framesvgitem.h:146
bool fromCurrentImageSet
This property holds whether the current SVG is present in the currently-used theme and no fallback is...
Definition framesvgitem.h:185
KSvg::FrameSvg::EnabledBorders enabledBorders
This property specifies which borders are shown.
Definition framesvgitem.h:179
int minimumDrawingWidth
This property holds the minimum width required to correctly draw this SVG.
Definition framesvgitem.h:226
QRegion mask
This property holds the mask that contains the SVG's painted areas.
Definition framesvgitem.h:208
KSvg::FrameSvgItemMargins * margins
This property holds the frame's margins.
Definition framesvgitem.h:153
int minimumDrawingHeight
This property holds the minimum height required to correctly draw this SVG.
Definition framesvgitem.h:217
Q_INVOKABLE bool hasElementPrefix(const QString &prefix) const
This method returns whether the SVG has the necessary elements with the given prefix to draw a frame.
Definition framesvg.cpp:130
bool isRepaintBlocked() const
This method returns whether we are in a transaction of many changes at once.
Definition framesvg.cpp:1027
Q_INVOKABLE int minimumDrawingHeight()
This method returns the minimum height required to correctly draw this SVG.
Definition framesvg.cpp:425
Q_INVOKABLE int minimumDrawingWidth()
This method returns the minimum width required to correctly draw this SVG.
Definition framesvg.cpp:433
Q_INVOKABLE qreal marginSize(const FrameSvg::MarginEdge edge) const
This method returns the margin size for the given edge.
Definition framesvg.cpp:197
QString actualPrefix() const
This method returns the prefix that is actually being used (including a '-' at the end if not empty).
Definition framesvg.cpp:1022
void setRepaintBlocked(bool blocked)
This method sets whether we should block rebuilding generated graphics for each change made.
Definition framesvg.cpp:1032
Q_INVOKABLE QRegion mask() const
This method returns a mask that tightly contains the fully opaque areas of the SVG.
Definition framesvg.cpp:330
void setEnabledBorders(const EnabledBorders borders)
This method sets which borders should be painted.
Definition framesvg.cpp:70
Q_INVOKABLE qreal insetSize(const FrameSvg::MarginEdge edge) const
This method returns the insets margin size for the specified edge.
Definition framesvg.cpp:223
Q_INVOKABLE void getMargins(qreal &left, qreal &top, qreal &right, qreal &bottom) const
This is a convenience method that extracts the size of the four margins and saves their size into the...
Definition framesvg.cpp:275
Q_INVOKABLE QString prefix()
This method returns the prefix for SVG elements of the FrameSvg (including a '-' at the end if not em...
Definition framesvg.cpp:160
Q_INVOKABLE void setElementPrefix(KSvg::FrameSvg::LocationPrefix location)
This method sets the prefix (.
Definition framesvg.cpp:88
Q_INVOKABLE void setImagePath(const QString &path) override
Loads a new Svg.
Definition framesvg.cpp:55
Q_INVOKABLE QPixmap framePixmap()
This method returns a pixmap of the SVG represented by this object.
Definition framesvg.cpp:392
Q_INVOKABLE void resizeFrame(const QSizeF &size)
This method resizes the frame, maintaining the same border size.
Definition framesvg.cpp:165
Q_INVOKABLE qreal fixedMarginSize(const FrameSvg::MarginEdge edge) const
This method returns the margin size for the specified edge.
Definition framesvg.cpp:249
void imageSetChanged(const QString &basePath)
@brif This signal is emitted when the user makes changes to the theme.
QString filePath(const QString &name) const
This method returns the path for a generic file in the current theme.
Definition imageset.cpp:194
void statusChanged(KSvg::Svg::Status status)
This signal is emitted when the status has changed.
void setStatus(Svg::Status status)
This method sets the image in a selected status.
Definition svg.cpp:1087
void fromCurrentImageSetChanged(bool fromCurrentImageSet)
This signal is emitted when the value of fromCurrentImageSet() has changed.
qreal devicePixelRatio() const
This method returns the device pixel ratio for this Svg.
Definition svg.cpp:885
void setDevicePixelRatio(qreal factor)
This method sets the device pixel ratio for the Svg.
Definition svg.cpp:874
ImageSet * imageSet() const
This method returns the KSvg::ImageSet used by this Svg object.
Definition svg.cpp:1082
void repaintNeeded()
This signal is emitted whenever the SVG data has changed in such a way that a repaint is required.
void imageSetChanged(ImageSet *imageSet)
This signal is emitted when the image set has changed.
Q_INVOKABLE bool hasElement(const QString &elementId) const
This method checks whether an element exists in the loaded SVG.
Definition svg.cpp:996
Q_INVOKABLE QSizeF elementSize(const QString &elementId) const
This method returns the size of a given element.
Definition svg.cpp:974
QColor neutralTextColor
QColor textColor
QColor highlightColor
QColor negativeTextColor
QColor backgroundColor
QColor highlightedTextColor
QColor positiveTextColor
Q_SCRIPTABLE CaptureState status()
const T & constLast() const const
bool isEmpty() const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
T qobject_cast(QObject *object)
QImage toImage() const const
virtual void classBegin()=0
virtual void componentComplete()=0
ItemHasContents
ItemChange
virtual void classBegin() override
virtual void componentComplete() override
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
height
implicitHeight
implicitWidth
bool isComponentComplete() const const
virtual void itemChange(ItemChange change, const ItemChangeData &value)
QSizeF size() const const
smooth
void update()
virtual QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *updatePaintNodeData)
width
QQuickWindow * window() const const
CreateTextureOptions
QString sceneGraphBackend()
qreal height() const const
bool isEmpty() const const
bool isValid() const const
void setHeight(qreal height)
void setWidth(qreal width)
QSizeF size() const const
qreal width() const const
QSGGeometry * geometry()
void updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &textureRect)
QSGMaterial * material() const const
QSGMaterial * opaqueMaterial() const const
DirtyGeometry
QSGNode()
void appendChildNode(QSGNode *node)
QSGNode * firstChild() const const
void markDirty(DirtyState bits)
QSGNode * nextSibling() const const
QSGNode * parent() const const
void setFiltering(QSGTexture::Filtering filtering)
void setRect(const QRectF &r)
QSGTexture * texture() const const
Filtering
Repeat
virtual QRectF normalizedTextureSubRect() const const
virtual QSize textureSize() const const=0
int height() const const
bool isEmpty() const const
int width() const const
qreal height() const const
QSize toSize() const const
qreal width() const const
bool isEmpty() const const
QTextStream & fixed(QTextStream &stream)
bool canConvert() const const
QString toString() const const
QStringList toStringList() const const
qreal devicePixelRatio() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:51 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:51 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.