QwtSymbol(3)
π QwtSymbol(3) π
Okay so bestie, welcome to QwtSymbol(3) from the Library Functions Manual β this is part 1, and she is long, but we're gonna get through it together. π
β¨ NAME β¨
QwtSymbol β a class for drawing symbols.
π¦ SYNOPSIS π¦
#include <qwt_symbol.h>
π Public Types π
enum Style { NoSymbol = -1, Ellipse, Rect, Diamond, Triangle, DTriangle,
UTriangle, LTriangle, RTriangle, Cross, XCross, HLine, VLine, Star1,
Star2, Hexagon, Path, Pixmap, Graphic, SvgDocument, UserStyle = 1000
}
enum CachePolicy { NoCache, Cache, AutoCache }
π Public Member Functions π
Every signature here is exactly as the API says, bestie β no renaming, no merging, no invented options. β¨
QwtSymbol (Style=NoSymbol)
QwtSymbol (Style, const QBrush &, const QPen &, const QSize &)
Constructor.
QwtSymbol (const QPainterPath &, const QBrush &, const QPen &)
Constructor.
virtual ~QwtSymbol ()
Destructor.
void setCachePolicy (CachePolicy)
CachePolicy cachePolicy () const
void setSize (const QSize &)
void setSize (int width, int height=-1)
Specify the symbol's size.
const QSize & size () const
void setPinPoint (const QPointF &pos, bool enable=true)
Set and enable a pin point.
QPointF pinPoint () const
void setPinPointEnabled (bool)
bool isPinPointEnabled () const
virtual void setColor (const QColor &)
Set the color of the symbol.
void setBrush (const QBrush &)
Assign a brush.
const QBrush & brush () const
void setPen (const QColor &, qreal width=0.0,
Qt::PenStyle=Qt::SolidLine)
void setPen (const QPen &)
const QPen & pen () const
void setStyle (Style)
Style style () const
void setPath (const QPainterPath &)
Set a painter path as symbol.
const QPainterPath & path () const
void setPixmap (const QPixmap &)
const QPixmap & pixmap () const
void setGraphic (const QwtGraphic &)
const QwtGraphic & graphic () const
void setSvgDocument (const QByteArray &)
void drawSymbol (QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
void drawSymbol (QPainter *, const QPointF &) const
Draw the symbol at a specified position.
void drawSymbols (QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
void drawSymbols (QPainter *, const QPointF *, int numPoints) const
virtual QRect boundingRect () const
void invalidateCache ()
π§ Protected Member Functions π§
virtual void renderSymbols (QPainter *, const QPointF *, int numPoints)
const
πΈ Detailed Description πΈ
A class for drawing symbols.
Definition at line 31 of file qwt_symbol.h.
π Member Enumeration Documentation π
enum QwtSymbol::CachePolicy
So depending on the render engine and the complexity of the symbol shape, it might be faster to render the symbol to a pixmap and then paint that pixmap. Vibe check: caching can be a whole moment.
For example, the raster paint engine is a pure software renderer where, in cache mode, a draw operation usually ends in a raster operation with the backing store β and those are usually faster than the algorithms for rendering polygons. But the opposite can be expected for graphic pipelines that can make use of hardware acceleration.
The default setting is AutoCache.
See also: setCachePolicy(), cachePolicy()
Note: The policy has no effect, when the symbol is painted to a vector graphics format (SVG).
Warning: Since Qt 4.8 raster is the default backend on X11.
Enumerator
NoCacheβ Don't use a pixmap cache.Cacheβ Always use a pixmap cache.AutoCacheβ Use a cache when one of the following conditions is true:- The symbol is rendered with the software renderer (
QPaintEngine::Raster)
- The symbol is rendered with the software renderer (
Definition at line 150 of file qwt_symbol.h.
enum QwtSymbol::Style
Symbol Style
See also: setStyle(), style()
Enumerator
NoSymbolβ No Style. The symbol cannot be drawn.Ellipseβ Ellipse or circle.Rectβ Rectangle.Diamondβ Diamond.Triangleβ Triangle pointing upwards.DTriangleβ Triangle pointing downwards.UTriangleβ Triangle pointing upwards.LTriangleβ Triangle pointing left.RTriangleβ Triangle pointing right.Crossβ Cross (+).XCrossβ Diagonal cross (X).HLineβ Horizontal line.VLineβ Vertical line.Star1β X combined with +.Star2β Six-pointed star.Hexagonβ Hexagon.Pathβ The symbol is represented by a painter path, where the origin ( 0, 0 ) of the path coordinate system is mapped to the position of the symbol. See also:setPath(),path()Pixmapβ The symbol is represented by a pixmap. The pixmap is centered or aligned to its pin point. See also:setPinPoint()Graphicβ The symbol is represented by a graphic. The graphic is centered or aligned to its pin point. See also:setPinPoint()SvgDocumentβ The symbol is represented by a SVG graphic. The graphic is centered or aligned to its pin point. See also:setPinPoint()UserStyleβ Styles >=QwtSymbol::UserSymbolare reserved for derived classes ofQwtSymbolthat overloaddrawSymbols()with additional application specific symbol types.
Definition at line 38 of file qwt_symbol.h.
π Constructor & Destructor Documentation π
QwtSymbol::QwtSymbol (Style style = NoSymbol) [explicit]
Default Constructor
Parameters
- style β Symbol Style.
The symbol is constructed with gray interior, black outline with zero width, no size and style NoSymbol.
Definition at line 843 of file qwt_symbol.cpp.
QwtSymbol::QwtSymbol (QwtSymbol::Style style, const QBrush & brush, const QPen & pen, const QSize & size)
Constructor.
Parameters
- style β Symbol Style.
- brush β brush to fill the interior.
- pen β outline pen.
- size β size.
See also: setStyle(), setBrush(), setPen(), setSize()
Definition at line 858 of file qwt_symbol.cpp.
QwtSymbol::QwtSymbol (const QPainterPath & path, const QBrush & brush, const QPen & pen)
Constructor. The symbol gets initialized by a painter path. The style is set to QwtSymbol::Path, the size is set to empty ( the path is displayed unscaled ).
Parameters
- path β painter path.
- brush β brush to fill the interior.
- pen β outline pen.
See also: setPath(), setBrush(), setPen(), setSize()
Definition at line 878 of file qwt_symbol.cpp.
QwtSymbol::~QwtSymbol () [virtual]
Destructor.
Definition at line 886 of file qwt_symbol.cpp.
π MEMBER FUNCTION DOCUMENTATION π
Okay bestie, this is the part where we meet every method in QwtSymbol β no skipping, no βtl;drβ, weβre doing the whole roster. π
QRect QwtSymbol::boundingRect () const [virtual]
This one calculates the bounding rectangle for a symbol sitting at position (0,0). Cute.
Returns: Bounding rectangle
Definition: line 1637 of qwt_symbol.cpp.
const QBrush & QwtSymbol::brush () const
Hands you the brush. Literally.
Returns: Brush
See also: setBrush()
Definition: line 1123 of qwt_symbol.cpp.
QwtSymbol::CachePolicy QwtSymbol::cachePolicy () const
Tells you the current cache policy β the vibe check for caching. β¨
Returns: Cache policy
See also: CachePolicy, setCachePolicy()
Definition: line 913 of qwt_symbol.cpp.
void QwtSymbol::drawSymbol (QPainter * painter, const QPointF & pos) const [inline]
Draws the symbol at a specified position. Slay.
Parameters:
painterβ Painterposβ Position of the symbol in screen coordinates
Definition: line 238 of qwt_symbol.h.
void QwtSymbol::drawSymbol (QPainter * painter, const QRectF & rect) const
Draws the symbol into a rectangle. The symbol is painted centered and scaled into the target rectangle. It is always painted uncached and the pin point is ignored β so donβt expect cache or pinpoint magic here. This method is primarily intended for drawing a symbol to the legend.
Parameters:
painterβ Painterrectβ Target rectangle for the symbol
Definition: line 1434 of qwt_symbol.cpp.
void QwtSymbol::drawSymbols (QPainter * painter, const QPointF * points, int numPoints) const
Renders an array of symbols. Painting several symbols is more effective than drawing symbols one by one, as a couple of layout calculations and setting of pen/brush can be done once for the complete array. Efficiency ate, no cap. π
Parameters:
painterβ Painterpointsβ Array of pointsnumPointsβ Number of points
Definition: line 1307 of qwt_symbol.cpp.
void QwtSymbol::drawSymbols (QPainter * painter, const QPolygonF & points) const [inline]
Draws symbols at the specified points.
Parameters:
painterβ Painterpointsβ Positions of the symbols in screen coordinates
Definition: line 251 of qwt_symbol.h.
const QwtGraphic & QwtSymbol::graphic () const
Returns the assigned graphic.
Returns: Assigned graphic
See also: setGraphic()
Definition: line 1027 of qwt_symbol.cpp.
void QwtSymbol::invalidateCache ()
Invalidates the cached symbol pixmap. The symbol invalidates its cache whenever an attribute is changed that has an effect on how to display a symbol. In case of derived classes with individual styles ( >= QwtSymbol::UserStyle ) it might be necessary to call invalidateCache() for attributes that are relevant for this style. Important little detail, bestie. π«Ά
See also: CachePolicy, setCachePolicy(), drawSymbols()
Definition: line 1770 of qwt_symbol.cpp.
bool QwtSymbol::isPinPointEnabled () const
Returns whether the pin point translation is enabled.
Returns: True, when the pin point translation is enabled
See also: setPinPoint(), setPinPointEnabled()
Definition: line 1291 of qwt_symbol.cpp.
const QPainterPath & QwtSymbol::path () const
Returns the painter path used for displaying the symbol.
Returns: Painter path for displaying the symbol
See also: setPath()
Definition: line 977 of qwt_symbol.cpp.
const QPen & QwtSymbol::pen () const
Returns the pen.
Returns: Pen
See also: setPen(), brush()
Definition: line 1171 of qwt_symbol.cpp.
QPointF QwtSymbol::pinPoint () const
Returns the pin point.
Returns: Pin point
See also: setPinPoint(), setPinPointEnabled()
Definition: line 1267 of qwt_symbol.cpp.
const QPixmap & QwtSymbol::pixmap () const
Returns the assigned pixmap.
Returns: Assigned pixmap
See also: setPixmap()
Definition: line 1002 of qwt_symbol.cpp.
void QwtSymbol::renderSymbols (QPainter * painter, const QPointF * points, int numPoints) const [protected], [virtual]
Render the symbol to series of points.
Parameters:
painterβ Qt painterpointsβ Positions of the symbolsnumPointsβ Number of points
Definition: line 1513 of qwt_symbol.cpp.
void QwtSymbol::setBrush (const QBrush & brush)
Assign a brush. The brush is used to draw the interior of the symbol.
Parameters: brush β Brush
See also: brush()
Definition: line 1107 of qwt_symbol.cpp.
void QwtSymbol::setCachePolicy (QwtSymbol::CachePolicy policy)
Change the cache policy. The default policy is AutoCache.
Parameters: policy β Cache policy
See also: CachePolicy, cachePolicy()
Definition: line 899 of qwt_symbol.cpp.
void QwtSymbol::setColor (const QColor & color) [virtual]
Set the color of the symbol. Change the color of the brush for symbol types with a filled area. For all other symbol types the color will be assigned to the pen.
Parameters: color β Color
See also: setBrush(), setPen(), brush(), pen()
Definition: line 1186 of qwt_symbol.cpp.
void QwtSymbol::setGraphic (const QwtGraphic & graphic)
Set a graphic as symbol.
Parameters: graphic β Graphic
See also: graphic(), setPixmap()
Note:
- the
style()is set toQwtSymbol::Graphic brush()andpen()have no effect
Definition: line 1017 of qwt_symbol.cpp.
void QwtSymbol::setPath (const QPainterPath & path)
Set a painter path as symbol. The symbol is represented by a painter path, where the origin ( 0, 0 ) of the path coordinate system is mapped to the position of the symbol.
When the symbol has valid size the painter path gets scaled to fit into the size. Otherwise the symbol size depends on the bounding rectangle of the path.
Example: The following code defines a symbol drawing an arrow:
#include <qwt_symbol.h>
QwtSymbol *symbol = new QwtSymbol();
QPen pen( Qt::black, 2 );
pen.setJoinStyle( Qt::MiterJoin );
symbol->setPen( pen );
symbol->setBrush( Qt::red );
QPainterPath path;
path.moveTo( 0, 8 );
path.lineTo( 0, 5 );
path.lineTo( -3, 5 );
path.lineTo( 0, 0 );
path.lineTo( 3, 5 );
path.lineTo( 0, 5 );
QTransform transform;
transform.rotate( -30.0 );
path = transform.map( path );
symbol->setPath( path );
symbol->setPinPoint( QPointF( 0.0, 0.0 ) );
setSize( 10, 14 );
Parameters: path β Painter path
Note: The style is implicitly set to QwtSymbol::Path.
See also: path(), setSize()
Definition: line 966 of qwt_symbol.cpp.
void QwtSymbol::setPen (const QColor & color, qreal width = 0.0, Qt::PenStyle style = Qt::SolidLine)
Build and assign a pen.
In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it non cosmetic ( see QPen::isCosmetic() ). This method has been introduced to hide this incompatibility.
Parameters:
colorβ Pen colorwidthβ Pen widthstyleβ Pen style
See also: pen(), brush()
Definition: line 1141 of qwt_symbol.cpp.
void QwtSymbol::setPen (const QPen & pen)
Assign a pen. The pen is used to draw the symbolβs outline.
Parameters: pen β Pen
See also: pen(), setBrush()
Definition: line 1155 of qwt_symbol.cpp.
void QwtSymbol::setPinPoint (const QPointF & pos, bool enable = true)
Set and enable a pin point. The position of a complex symbol is not always aligned to its center ( f.e an arrow, where the peak points to a position ). The pin point defines the position inside of a Pixmap, Graphic, SvgDocument or PainterPath symbol where the represented point has to be aligned to.
Parameters:
posβ Positionenableβ En/Disable the pin point alignment
See also: pinPoint(), setPinPointEnabled()
Definition: line 1249 of qwt_symbol.cpp.
void QwtSymbol::setPinPointEnabled (bool on)
En/Disable the pin point alignment.
Parameters: on β Enabled, when on is true
See also: setPinPoint(), isPinPointEnabled()
Definition: line 1278 of qwt_symbol.cpp.
void QwtSymbol::setPixmap (const QPixmap & pixmap)
Set a pixmap as symbol.
Parameters: pixmap β Pixmap
See also: pixmap(), setGraphic()
Note:
- the
style()is set toQwtSymbol::Pixmap brush()andpen()have no effect
Definition: line 992 of qwt_symbol.cpp.
void QwtSymbol::setSize (const QSize & size)
Set the symbolβs size.
Parameters: size β Size
See also: size()
Definition: line 1081 of qwt_symbol.cpp.
void QwtSymbol::setSize (int width, int height = -1)
Specify the symbolβs size. If the 'h' parameter is left out or less than 0, and the 'w' parameter is greater than or equal to 0, the symbol size will be set to (w,w).
Parameters:
widthβ Widthheightβ Height (defaults to-1)
See also: size()
Definition: line 1067 of qwt_symbol.cpp.
void QwtSymbol::setStyle (QwtSymbol::Style style)
Specify the symbol style.
Parameters: style β Style
See also: style()
Definition: line 1782 of qwt_symbol.cpp.
void QwtSymbol::setSvgDocument (const QByteArray & svgDocument)
Set a SVG icon as symbol.
Parameters: svgDocument β SVG icon
See also: setGraphic(), setPixmap()
Note:
- the
style()is set toQwtSymbol::SvgDocument brush()andpen()have no effect
Definition: line 1044 of qwt_symbol.cpp.
const QSize & QwtSymbol::size () const
Returns the size.
Returns: Size
See also: setSize()
Definition: line 1094 of qwt_symbol.cpp.
QwtSymbol::Style QwtSymbol::style () const
Returns the current symbol style.
Returns: Current symbol style
See also: setStyle()
Definition: line 1795 of qwt_symbol.cpp.
πΈ AUTHOR πΈ
Generated automatically by Doxygen for Qwt Userβs Guide from the source code.
Thatβs the whole vibe check, bestie β the footer source/version situation is Qwt Userβs Guide + QwtSymbol(3), with no separate date line on this page. Mwah. ππ
β¨
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms